UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal not in range(128)

python的编码问题一直是头痛,比如matplotlib画图只接受utf-8编码,如果没有设置就会在画图时报错。 有时间整整这个python编码;

如标题所示,解决方案:加入

import sys
reload(sys)
sys.setdefaultencoding("utf-8")

猜你喜欢

转载自blog.csdn.net/abcjennifer/article/details/47021569