问题描述
在用python读txt文件的时候遇到了编码问题:‘utf-8’ codec can’t decode byte 0xb70,同样的代码之前在python2的时候是不会出现问题的。用百度找了一下也没能找到有效的解决方法,后来在stackoverflow上找到了类似的问题。
stackoverflow问题
解决方案
str = unicode(str, errors='replace')
or
str = unicode
在用python读txt文件的时候遇到了编码问题:‘utf-8’ codec can’t decode byte 0xb70,同样的代码之前在python2的时候是不会出现问题的。用百度找了一下也没能找到有效的解决方法,后来在stackoverflow上找到了类似的问题。
stackoverflow问题
str = unicode(str, errors='replace')
or
str = unicode