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

版权声明:版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/DarrenXf/article/details/82957313
  1. Python 3 与 Python 2 有很大的区别,其中Python 3 系统默认使用的就是utf-8编码。
  2. 所以,对于使用的是Python 3 的情况,就不需要sys.setdefaultencoding(“utf-8”)这段代码。
  3. 最重要的是,Python 3 的 sys 库里面已经没有 setdefaultencoding() 函数了。

猜你喜欢

转载自blog.csdn.net/DarrenXf/article/details/82957313