UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position解决方法

python2.x的默认编码是ascii,而代码中可能由utf-8的字符导致,解决方法是设置utf-8

if sys.getdefaultencoding() != 'utf-8':
    reload(sys)
    sys.setdefaultencoding('utf-8')

参考:https://blog.csdn.net/jewelsu/article/details/78683024

发布了54 篇原创文章 · 获赞 209 · 访问量 9万+

猜你喜欢

转载自blog.csdn.net/qq_34284638/article/details/86493535