list-tuple-dict-set的文件操作

import pickle #数据持久性模块

myList = [1,2,3,4,5,'sunck is a good man']
path = r'D:\juhe\xieyinew\data\3.txt'
f = open(path,'wb')

pickle.dump(myList,f)
f.close()

#读取
f1 = open(path,'rb')
tempList = pickle.load(f1)
print(tempList)
f1.close()
posted @ 2018-07-18 16:56  yanghaotai  阅读(91)  评论(0)    收藏  举报