Why there is no "setdefaultencoding" in sys module?

crow wentlv at gmail.com
Fri Jul 9 11:58:35 EDT 2010


Hi, everyone

I'm a new hand at python.

I tried to set system default encoding by using

    "import sys; sys.setdefaultencoding('utf-f')",

but I got error message:

>>> sys.setdefaultencoding('utf-8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'setdefaultencoding'

Then I checked dir(sys), seems there was no function named
"setdefaultencoding" in "sys" module. But in python's document, it
said I should use sys.setdefaultencoding.

So, my questions: why there is no setdefaultencoding in sys module? if
I want to change system's default encoding, what should I do?

Thanks in advance



More information about the Python-list mailing list