Why there is no "setdefaultencoding" in sys module?
rajindermohan001 at gmail.com
rajindermohan001 at gmail.com
Thu Feb 15 02:07:00 EST 2018
On Friday, July 9, 2010 at 9:28:35 PM UTC+5:30, crow wrote:
> 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
Becuase you are using python 3.setdefaultencoding is no longer supportedin python 3. python3automatically have utf-8 in its configuration by default. so you don't have to use it. just remove the line.
More information about the Python-list
mailing list