报错信息:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(xxx)
场景:
python代码
使用了utf8编码对包含汉字的信息进行编码
在解码的时候报错无法解析
解决办法:
在文件开头添加:
import sys;
reload(sys);
sys.setdefaultencoding(“utf8”)
报错信息:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(xxx)
场景:
python代码
使用了utf8编码对包含汉字的信息进行编码
在解码的时候报错无法解析
解决办法:
在文件开头添加:
import sys;
reload(sys);
sys.setdefaultencoding(“utf8”)