1. 首页
  2. 数据库
  3. 其它
  4. python实现通过shelve修改对象实例

python实现通过shelve修改对象实例

上传者: 2020-12-31 18:43:59上传 PDF文件 32.15KB 热度 8次
本文实例讲述了python实现通过shelve修改对象的方法,分享给大家供大家参考。 具体实现方法如下: import shelve she = shelve.open('try.she','c') for c in 'spam': she[c] = {c:23} for c in she.keys(): print c,she[c] she.close() she = shelve.open('try.she','c') print she['p'] she['p']['p'] = 42 #这样修改是不行,这只是修改了个临时对象 print she['p'] a = she['p'
下载地址
用户评论