为什么我的默认编码是python2.7.2的utf8?

2024-05-19 20:12:05 发布

您现在位置:Python中文网/ 问答频道 /正文

在Python中,defaultencoding存储在unicode_default_encoding中,我找到了所有Python源代码,其中有2个函数。在

  1. _PyUnicode_Init() //strcpy(unicode_default_encoding, "ascii");
  2. setencoding()中站点.py在

所以没有人修改defaultencoding。那为什么我的默认编码是'utf-8'?在


Tags: 函数pydefault编码源代码站点initascii
1条回答
网友
1楼 · 发布于 2024-05-19 20:12:05

查找中的设置站点.py将影响默认编码。在

退房http://blog.ianbicking.org/illusive-setdefaultencoding.html

Edit site.py (in the standard library) directly. Seems like a bad idea. Though maybe I'll just delete the del sys.setdefaultencoding line... anyway, site.py might appear in other places on your computer as well (e.g., /etc/pythonX.Y/site.py).

相关问题 更多 >