Re: (no subject)

Tom Emerson <[email protected]>
Newsgroups gmane.comp.python.internationalization
Message-ID <[email protected]>
Colin Yu writes:
> Is there a way to take a unicode string like u",C,,C<,B6,C< ,C*,C3,B?" 
> (which are Japanese characters in UTF-8 format) and convert it to unicode 
> (\uXXXX format) escape codes in python?  Your help would be greatly 
> appreciated. Thank you.

Use "repr".

>>> foo = u"\u4e00"
>>> repr(foo)
"u'\\u4E00'"

-- 
Tom Emerson                                          Basis Technology Corp.
Sr. Sinostringologist                              http://www.basistech.com
  "Beware the lollipop of mediocrity: lick it once and you suck forever"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.