to express unicode string
Terry Reedy
tjreedy at udel.edu
Sat Jan 28 18:03:41 EST 2012
On 1/28/2012 2:58 PM, Michael Torrie wrote:
> On 01/28/2012 12:21 AM, contro opinion wrote:
>>>>> s='你好'
>
> On my computer, s is a byte string that contains the utf-8 formatted
> encoding of 你好.
On mine, s is a (unicode) string containing those two characters. That
is because I pasted the above into IDLE 3.2.2 (on Win7, but should be
the same on all systems). (Pasting into the standard interpreter window,
which uses Windows stupid Command Prompt interface, does not work.)
To the OP. if you want to work easily with unicode, use Python 3.2 now
and Python 3.3 as soon as it comes out, in less than a year. We went
through the hassle of changing the string type from bytes to unicode
*because* having unicode as merely an add-on type was not working very well.
--
Terry Jan Reedy
More information about the Python-list
mailing list