unicode positions of characters

Martin v. Löwis martin at v.loewis.de
Thu Jan 16 15:47:35 CET 2003

Giorgi Lekishvili <gleki at gol.ge> writes:

> Could somebody tell me how can I get the unicode hexadecimals of chars?
> e.g., 'char'  --> xyzv

I thought I understood the question, but then your example breaks this
understanding. What has the identifier xyzv to do with the string
literal 'char'? Where is anything hexadecimal, or unicode, in this

To get the Unicode ordinal from a Unicode character, use the ord
function. To get a hexadecimal representation of a number, use the hex

>>> s=u"Hello"
>>> ord(s[0])
>>> hex(ord(s[0]))


More information about the Python-list mailing list