AttributeError: module 'sys' has no attribute 'setdefaultencoding'
Posted 小夕公子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AttributeError: module 'sys' has no attribute 'setdefaultencoding'相关的知识,希望对你有一定的参考价值。
import sys reload(sys) sys.setdefaultencoding("utf-8")
报错:
reload 未声明
然后
import sys sys.setdefaultencoding("utf-8")
报错
AttributeError: module ‘sys‘ has no attribute ‘setdefaultencoding‘
经过百度发现
Python3字符串默认编码unicode, 所以sys.setdefaultencoding也不存在了。。。。。。
所以删掉就好了。
以上是关于AttributeError: module 'sys' has no attribute 'setdefaultencoding'的主要内容,如果未能解决你的问题,请参考以下文章