when calling dbm opento force python to create the file if it does not yet exist and to simply open it for reads and writes otherwise this used to be the default behavior but is no longer you do not need the 'cargument when opening shelves discussed ahead--they still use an "open or create'cmode by default if passed no open mode argument other open mode strings can be passed to dbmincluding to always create the fileand for read-only of an existing file--the new default see the python library manual for more details in additionpython stores both key and value strings as bytes instead of str as we've seen (which turns out to be convenient for pickled data in shelvesdiscussed aheadand no longer ships with bsddb as standard component--it' available independently on the web as third-party extensionbut in its absence python falls back on its own dbm file implementation since the underlying dbm implementation rules are prone to change with timeyou should always consult python' library manuals as well as the dbm module' standard library source code for more information pickled objects probably the biggest limitation of dbm keyed files is in what they can storedata stored under key must be simple string if you want to store python objects in dbm fileyou can sometimes manually convert them to and from strings on writes and reads ( with str and eval calls)but this takes you only so far for arbitrarily complex python objects such as class instances and nested data structuresyou need something more class instance objectsfor examplecannot usually be later re-created from their standard string representations moreovercustom to-string conversions and fromstring parsers are error prone and not general the python pickle modulea standard part of the python systemprovides the conversion step needed it' sort of super general data formatting and de-formatting tool--pickle converts nearly arbitrary python in-memory objects to and from single linear string formatsuitable for storing in flat filesshipping across network sockets between trusted sourcesand so on this conversion from object to string is often called serialization--arbitrary data structures in memory are mapped to serial string form the string representation used for objects is also sometimes referred to as byte streamdue to its linear format it retains all the content and references structure of the original in-memory object when the object is later re-created from its byte stringit will be new in-memory object identical in structure and value to the originalthough located at different memory address the net effect is that the re-created object is effectively copy of the originalin pythonspeakthe two will be =but not is since the recreation typically happens in an entirely pickled objects