Most of the databases in this chapter are opened using a variation of the open() function (defined in each database module):
open(filename [,flag [, mode ]])
This function opens the database file filename and returns a database object. flag is ‘r’ for read-only access, ‘w’ for read-write access, ‘c’ to create the database if it doesn’t exist, or ‘n’ to force the creation of a new database. mode is the integer file-access mode used when creating the database (the default is 0666 on UNIX).
The object returned by the open() function supports the following dictionary-like operations:
|d[key] = value||Inserts value into the database|
|value = d[key]||Gets data from the database|
|del d[key]||Removes a database entry|