libJournal v1.2.0¶
This version of libJournal is very similar to v1.1.0, and in-fact most of the documentation has been transfered over. The only difference is 1 new method. In order to install this version, run this:;
pip install libJournal==1.2.0
Once installed, this must be completed before using the rest of the library. Yet this is slightly different as the create_json() method can be used if the JSON doesn’t exist beforehand:
# Import libJournal
from libjournal.libj import libJournal
# Initialize the libJournal object & set the location of the JSON
libj = libJournal()
# Creates a json called "name.json" and then sets it as the JSON location
libj.create_json("name")
libj.set_json_location("name.json")
The entry_add() method is used to add entries and the entry_delete() method is used to delete entries:
# Adds an entry with the name "title", and with the content "Cats"
libj.add_entry("Title", "Cats")
# Deletes an entry with the name "title", and with the content "Cats"
libj.delete_entry("Title")
Please note that entry titles cannot be the same! Next in use the find_entry() method in order to search for an entry based on title and return true or false:
# Searches for the entry with the title "Title" and returns a boolean
libj.find_entry("Title")
Finally, you can use the read_entry() in order to read a certain entry:
# Opens the entry with the title "Title" and returns the content of that entry
libj.read_entry("Title")
That’s all for this version of libJournal!