A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-June/112122.html below:

set the default encoding to 'utf-8' in Python 3.3?

[Python-Dev] open(): set the default encoding to 'utf-8' in Python 3.3? [Python-Dev] open(): set the default encoding to 'utf-8' in Python 3.3?Ethan Furman ethan at stoneleaf.us
Tue Jun 28 21:06:01 CEST 2011
Ethan Furman wrote:
> Michael Foord wrote:
>> On 28/06/2011 17:34, Terry Reedy wrote:
>>> On 6/28/2011 10:48 AM, Michael Foord wrote:
>>>> On 28/06/2011 15:36, Terry Reedy wrote:
>>>
>>>>> S = open('myfile.txt').read()
>>>>> now return a text string in both Py2 and Py3 and a subsequent
>>>>> 'abc' in S
>>>>> works in both.
>>>>
>>>> Nope, it returns a bytestring in Python 2.
>>>
>>> Which, in Py2 is a str() object. 
>>
>> Yes, but not a "text string". The equivalent of the Python 2 str in 
>> Python 3 is bytes. Irrelevant discussion anyway.
> 
> Irrelevant to the OP, yes, but a Python 2 string *is not* the same as 
> Python 3 bytes.  If you don't believe me fire up your Python 3 shell and 
> try b'xyz'[1] == 'y'.

er, make that b'xyz'[1] == b'y'  :(
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4