发布时间:2019-09-16 07:34:33编辑:auto阅读(1570)
写入:
import cPickle as p
shoplistfile = 'data.data'
shoplist = ['meili',['current_account',[100000,1222],'basis_account',[5555555,888]],
'qinshan',['current_account',[1089000,12292],'basis_account',[55555955,888]],
'jiayou',['current_account',[10000,12292],'basis_account',[55555955,888]]
]
animallist=['hippo','rabbit','apple', 'mango', 'carrot']
f = file(shoplistfile, 'w')
p.dump(shoplist,f,True)
p.dump(animallist,f,True)
f.close()
读取:
f = file(shoplistfile)
storedlist = p.load(f)
animallist= p.load(f)
print storedlist
print animallist
结果:
上一篇: Python27 反射
下一篇: python列表基本语法
47842
46390
37283
34733
29313
25973
24916
19951
19544
18030
5792°
6413°
5927°
5961°
7064°
5911°
5944°
6438°
6404°
7778°