flat files are handy for simple persistence tasksbut they are generally geared toward sequential processing mode although it is possible to jump around to arbitrary locations with seek callsflat files don' provide much structure to data beyond the notion of bytes and text lines dbm filesa standard tool in the python library for database managementimprove on that by providing key-based access to stored text strings they implement randomaccesssingle-key view on stored data for instanceinformation related to objects can be stored in dbm file using unique key per object and later can be fetched back directly with the same key dbm files are implemented by variety of underlying modules (including one coded in python)but if you have pythonyou have dbm using dbm files although dbm filesystems have to do bit of work to map chunks of stored data to keys for fast retrieval (technicallythey generally use technique called hashing to store data in files)your scripts don' need to care about the action going on behind the scenes in factdbm is one of the easiest ways to save information in python--dbm files behave so much like in-memory dictionaries that you may forget you're actually dealing with file at all for instancegiven dbm file objectindexing by key fetches data from the file assigning to an index stores data in the file dbm file objects also support common dictionary methods such as keys-list fetches and tests and key deletions the dbm library itself is hidden behind this simple model since it is so simplelet' jump right into an interactive example that creates dbm file and shows how the interface worksc:\pp \dbasepython import dbm file dbm open('movie'' 'file['batman''pow!file keys([ 'batman'file['batman' 'pow!get interfacebsddbgnundbmdumb make dbm file called 'moviestore string under key 'batmanget the file' key directory fetch value for key 'batmanwho ['robin''cat-woman''joker'what ['bang!''splat!''wham!'for in range(len(who))file[who[ ]what[iadd more "recordsfile keys([ 'cat-woman' 'batman' 'joker' 'robin'len(file)'robinin filefile['joker'dbm files