Re: 'Straße' ('Strasse') and Python 2

Chris Angelico rosuav at gmail.com
Mon Jan 13 05:26:01 EST 2014


On Mon, Jan 13, 2014 at 8:54 PM,  <wxjmfauth at gmail.com> wrote:
> This assertions are correct (byte string and unicode).
>
>>>> sys.version
> '2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]'
>>>> assert 'Straße'[4] == 'ß'
>>>> assert u'Straße'[4] == u'ß'
>>>>
>
> jmf
>
> PS Nothing to do with Py2/Py3.

This means that either your source encoding happens to include that
character, or you have assertions disabled. It does NOT mean that you
can rely on writing this string out to a file and having someone else
read it in and understand it the same way.

ChrisA



More information about the Python-list mailing list