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

Jon Ribbens jon+usenet at unequivocal.co.uk
Wed Mar 9 10:06:36 EST 2016


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.



More information about the Python-list mailing list