from filepickle import table loaddbase('myfile'table {' '[ ]' '{' '[ ]' ' }table[' '][ savedbase('myfile'tablec:\pp \dbase>python from filepickle import print(loaddbase('myfile'){' '[ ]' '{' '[ ]' ' }reload/unpickle change shared object rewrite to the file both ' updated as expected besides built-in types like the liststuplesand dictionaries of the examples so farclass instances may also be pickled to file-like objects this provides natural way to associate behavior with stored data (class methods process instance attributesand provides simple migration path (class changes made in module files are automatically picked up by stored instanceshere' brief interactive demonstrationclass recdef __init__(selfhours)self hours hours def pay(selfrate= )return self hours rate bob rec( import pickle pickle dump(bobopen('bobrec''wb')rec pickle load(open('bobrec''rb')rec hours rec pay( we'll explore how this works in more detail in conjunction with shelves later in this -as we'll seealthough the pickle module can be used directly this wayit is also the underlying translation engine in both shelves and zodb databases in generalpython can pickle just about anythingexcept forcompiled code objectsfunctions and classes record just their names and those of their modules in picklesto allow for later reimport and automatic acquisition of changes made in module files instances of classes that do not follow class importability rulesin shortthe class must be importable on object loads (more on this at the end of the section "shelve fileson page instances of some built-in and user-defined types that are coded in or depend upon transient operating system states ( open file objects cannot be pickleda picklingerror is raised if an object cannot be pickled againwe'll revisit the pickler' constraints on pickleable objects and classes when we study shelves pickled objects