python TypeError: must be str, not bytes错误

1 TypeError: must be str, not bytes错误:
2 
3 解答: 
4  写文件处 f=open(filename, 'w')应该写为 open(filename, 'wb')
5  读文件时 f=open(filename,'rb')
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 0: illegal multibyte sequence解决方法同上

 

posted @ 2016-10-25 11:46  flay  阅读(1191)  评论(0编辑  收藏  举报