学习
实践
活动
专区
工具
TVP
写文章
专栏首页 恩蓝脚本 解决Python中报错TypeError: must be str, not bytes问题
2 0

海报分享

解决Python中报错TypeError: must be str, not bytes问题

如下所示:

#!/usr/bin/python
import pickle 
shoplist=['apple','mango','carrot']
f = open('c:\poem.txt','w')
pickle.dump(shoplist,f)
f.close()
del shoplist
f = open('c:\poem.txt','r')