Pyhon 2.x or 3.x, which is faster?

Tim Golden mail at timgolden.me.uk
Wed Mar 9 10:15:07 EST 2016


On 09/03/2016 15:06, Jon Ribbens wrote:
> On 2016-03-09, Steven D'Aprano <steve at pearwood.info> wrote:
>> generate the output. Without seeing the code you used, I have *no idea* how
>> you could get that result. If you read the file in binary, you should get
>> this:
>>
>> b'\xef\xbb\xbf\xe2\x82\xac\xe2\x82\xac\xe2\x82\xac'
>>
>> Or in decimal:
>>
>> 239, 187, 191, 226, 130, 172, 226, 130, 172, 226, 130, 172
>>
>> How you are getting 8218 instead of 130, I have no idea!
> 
> Decode as "windows-1252".
> 
>>> Changing it to UTF-8 however (CHCP 65001 in Windows) gives me this
>>> error when I run the program again:
>>>
>>> ----------
>>> Fatal Python error: Py_Initialize: can't initialize sys standard streams
>>> LookupError: unknown encoding: cp65001
> 
> cp65001 was added in Python 3.3, any earlier version (including any
> Python 2) will not understand it.

It's also somewhat flaky in other ways

  https://mail.python.org/pipermail/python-list/2015-December/700351.html

TJG



More information about the Python-list mailing list