视频的容积 发表于 2017-4-30 12:50:01

python -- 文档系列化

  


#test for pickle
#import pickle as p;
import cPickle as p;
lsShop = ['apple', 'mango', 'carrot'];
strFile = "lsShop.txt";
#write to file
f = file(strFile, "w");
p.dump(lsShop, f);#dump the object
f.close();
del lsShop;
#read back from the storage
f = file(strFile, "r");
lsShop = p.load(f);
f.close();
print lsShop;

 
页: [1]
查看完整版本: python -- 文档系列化