摘要: import pickle mylist=[[1,2,3,4,5,6,7],["abc","xyz","hello"],[1,2,3,4,5,6,7,"我"]] file=open(r"G:\我的python\尹成\python基础\day11\文件读写\list.bin","wb") pickle.dump(mylist,file) # 保存list到文件 file.close() myl... 阅读全文
posted @ 2018-07-06 15:10 睡觉了嘛 阅读(127) 评论(0) 推荐(0) 编辑
摘要: import codecs """ file = codecs.open(r"路径","rb","gbk","ignore") for line in file: # 硬盘模式 print(line) file.close() """ def loadata(): global datalist # 引用全局变量 把加载的内容放到全局变量中 file = codecs.... 阅读全文
posted @ 2018-07-06 14:31 睡觉了嘛 阅读(110) 评论(0) 推荐(0) 编辑