shelve将所有内容处理为字典
1 import shelve 2 f = shelve.open(r'abc') # 拿到句柄 3 f['name'] = {'name':'yumeng'} # 写入文件 4 f['name1'] = {'info':'liyulu','age':17} 5 f.close() 6 print(f.get('name1')['age']) # 取出元素