python 中cPickle学习二
生活随笔
收集整理的這篇文章主要介紹了
python 中cPickle学习二
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
寫入:
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結果:
轉載于:https://blog.51cto.com/357712148/2060678
總結
以上是生活随笔為你收集整理的python 中cPickle学习二的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: wdk1703+vs2015编译的诡异问
- 下一篇: 思维导图模板下载