On u'Unicode string literals' (Py3)

Dave Angel d at davea.name
Wed Feb 29 09:54:05 EST 2012


Just who are you replying to?

On 02/29/2012 08:45 AM, jmfauth wrote:
> For those who do not know:
> The u'' string literal trick has never worked in Python 2.
>

No trick there.  If you have something explicit to say, then say it.
>>>> sys.version
> '2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]'

Why then does the subject line say Py3 ?

>>>> print u'Un oeuf à zéro EURO uro'

You're testing three things here, so there's no telling which might be 
wrong.  Your source encoding, the implicit str() conversion for unicode, 
and the particular terminal you're printing it on.  It'd be amazing if 
all three were right, unless you're on Linux.

> Un  uf à zéro  uro
> jmf


-- 

DaveA




More information about the Python-list mailing list