首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

python的源

2012-10-25 
python的流参考http://linux.chinaitlab.com/manual/python_chinese/ch12.htmlhelp(file)#!/usr/bin/pytho

python的流
参考http://linux.chinaitlab.com/manual/python_chinese/ch12.html
help(file)

#!/usr/bin/python# Filename: pickling.pyimport cPickle as p#import pickle as pshoplistfile = 'shoplist.data'# the name of the file where we will store the objectshoplist = ['apple', 'mango', 'carrot']# Write to the filef = file(shoplistfile, 'w')p.dump(shoplist, f) # dump the object to a filef.close()del shoplist # remove the shoplist# Read back from the storagef = file(shoplistfile)storedlist = p.load(f)print storedlist 

上次看是1周,这次是一晚上

热点排行