![]() |
Help needed: Printing unicode characters in user defined format
Hi there,
how can I write out Python Unicode character's hexadecimal value in generic format? I need to loop thru characters in Unicode string and store each character in format \U+hhhh, where hhhh is the value of unicode character in hexadecimal? For example string: u'Hellö' should be written into file like this: '\U+0048\U+0065\U+006C\U+006C\U+00F6' -pekka- |
Re: Help needed: Printing unicode characters in user defined format
Pekka Niiranen wrote:
> I need to loop thru characters in Unicode string > and store each character in format \U+hhhh, where > hhhh is the value of unicode character in hexadecimal? "".join(['\\U+%.4x' % ord(c) for c in unistr]) HTH, Martin |
| All times are GMT. The time now is 06:00 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.