installed high degree of caution is also in order if you are using these database modules to store large amounts of datahave situation where multiple python programs might be opening the same database file concurrentlyor need high reliability and transactions (the sqlite module might be safer choice for thatshelve module the shelve module provides support for persistent objects using special "shelf object this object behaves like dictionary except that all the objects it contains are stored on disk using hash-table based database such as dbhashdbm or gdbm unlike those moduleshoweverthe values stored in shelf are not restricted to strings insteadany object that is compatible with the pickle module may be stored shelf is created using the shelve open(function open(filename [,flag=' [protocol [writeback]]]opens shelf file if the file doesn' existit' created filename should be the database filename and should not include suffix flag has the same meaning as described in the introduction and is one of ' '' '' 'or 'nif the database file doesn' existit is created protocol specifies the protocol used to pickle objects stored in the database it has the same meaning as described in the pickle module writeback controls the caching behavior of the database object if trueall accessed entries are cached in memory and only written back when the shelf is closed the default value is false returns shelf object once shelf is openedthe following dictionary operations can be performed on itoperation description [keydata data [keydel [keyd has_key(keyd keys( close( sync(stores data at key overwrites existing data retrieves data at key deletes data at key tests for the existence of key returns all keys closes the shelf writes unsaved data to disk the key values for shelf must be strings the objects stored in shelf must be serializable using the pickle module shelf(dict [protocol [writeback]] mixin class that implements the functionality of shelf on top of dictionary objectdict when this is usedobjects stored in the returned shelf object will be pickled and stored in the underlying dictionary dict both protocol and writeback have the same meaning as for shelve open(the shelve module uses the anydbm module to select an appropriate dbm module for use in most standard python installationsit is likely to be the dbhashwhich relies upon the berkeley db library lib fl ff