python 2.7 and unicode (one more time)

Chris Angelico rosuav at gmail.com
Thu Nov 20 07:41:53 EST 2014


On Thu, Nov 20, 2014 at 11:35 PM, Peter Otten <__peter__ at web.de> wrote:
> You don't need to change an all-ascii bytestring to unicode.
> Lo and behold:
>
>>>> "%s %s" % (u"üblich", u"ähnlich")
> u'\xfcblich \xe4hnlich'
>>>> u"%s %s" % (u"üblich", u"ähnlich")
> u'\xfcblich \xe4hnlich'
>
> Only non-ascii bytestrings mean trouble, either noisy
>

It's better to not depend on that, though. Be clear and explicit about
the difference between bytes and text, and don't try to pretend
they're the same thing, even for ASCII.

ChrisA



More information about the Python-list mailing list