搁置的示例代码

要搁置对象,首先导入模块,然后按如下方式分配对象值:

import shelve 
 database = shelve.open(filename.suffix) 
 object = Object() 
 database['key'] = object