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


经过证实这个是python2.7的bug一枚

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

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

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

猜你喜欢

转载自blog.csdn.net/master_ning/article/details/80300731