faqts : Computers : Programming : Languages : Python : Snippets

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 3 people (0%) answered Yes
Recently 0 of 3 people (0%) answered Yes

Entry

how do you take a unicode string like u"レーザー" and convert it into \uXXXX escape code?

Nov 20th, 2002 19:13
Ian Bicking, C. Yu,


Try repr:

>>> repr(u"レーザー")
"u'\\xe3f\\xac\\xe3f\\xbc\\xe3,\\xb6\\xe3f\\xbc'"