Create a database
With the shelve module we can use in the simpliest way a database that we can handle just easy as is easy to use a dictionary. In fact when we import the shelve module, that is a built-in module, you do not have to install anything apart Python, we create a db object creating a reference to the file like:
s = shelve.open(“database.db”)
Now, you can add your key to the database just like in a dictionary, like this:
s[‘key1’] = 100
"""Create a database svelve is the module to create it """ import shelve s = shelve.open("students.db") s.close()