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

  1. Python 3 与 Python 2 有很大的区别,其中Python 3 系统默认使用的就是utf-8编码。
  2. 所以,对于使用的是Python 3 的情况,就不需要sys.setdefaultencoding(“utf-8”)这段代码。
  3. 最重要的是,Python 3 的 sys 库里面已经没有 setdefaultencoding() 函数了。
原文地址:https://www.cnblogs.com/vercont/p/10210204.html