'Straße' ('Strasse') and Python 2
Thomas Rachel
nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Mon Jan 13 03:27:46 EST 2014
Am 12.01.2014 08:50 schrieb wxjmfauth at gmail.com:
>>>> sys.version
> 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
>>>> s = 'Straße'
>>>> assert len(s) == 6
>>>> assert s[5] == 'e'
>>>>
Wow. You just found one of the major differences between Python 2 and 3.
Your assertins are just wrong, as s = 'Straße' leads - provided you use
UTF8 - to a representation of 'Stra\xc3\x9fe', obviously leading to a
length of 7.
Thomas
More information about the Python-list
mailing list