How do you extract hex value of a Unicode character ?

John Lenton jlenton at gmail.com
Thu Jul 15 08:41:26 EDT 2004


On Thu, 15 Jul 2004 11:03:06 +0800, Posadas, Dennis
<dennis.posadas at intel.com> wrote:
> If unichr(x), where x is a value like 0x4EEE will give you the
> character as mapped in the Unicode tables, what is the opposite of
> this command? In other words, how do I get the 0xABCD value from the
> character itself ?

ord returns the ordinal of the character; if it is a unicode
character, the unicode ordinal. In other words, ord(unichr(0xABCD)) ==
0xABCD

-- 
John Lenton (jlenton at gmail.com) -- Random fortune:
bash: fortune: command not found



More information about the Python-list mailing list