如下所示:#!/usr/bin/pythonimportpickleshoplist=['apple','mango','carrot']f=open('c:\poem.txt','w')pickle.dump(shoplist,f)f.close()delshoplistf=open('c:\poem.txt','r')storedlist=pickle.load(f)print(storedlist)执行上述程序时候报错:TypeError:mustbestr,notbytes解决方法:在使用open打开文件的时候,加个bf=open('c:\poem.txt','wb‘)f=open('c:\poem.txt','rb')补充知识:TypeError:LoadLibr...
继续阅读 >