AttributeError: module 'sys' has no attribute 'setdefaultencoding'

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

Error:

reload is not declared

 

Then

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

report an error

AttributeError: module 'sys' has no attribute 'setdefaultencoding'

Discovered by Baidu

Python3字符串默认编码unicode, 所以sys.setdefaultencoding也不存在了。。。。。。

So just delete it.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325338940&siteId=291194637