an hex number problem

Fredrik Lundh fredrik at pythonware.com
Thu Dec 21 07:41:10 EST 2006


could.net at gmail.com wrote:

> I got a number 19968:

 >>> x = 19968

> 1. how can I change it to the hex form 0x4e00,

 >>> hex(x)
'0x4e00'

> 2. and how can I change 0x4e00 to a python unicode character u"\u4e00"?

 >>> unichr(x)
u'\u4e00'

also see:

     http://effbot.org/pyfaq/how-do-i-convert-a-number-to-a-string

</F>




More information about the Python-list mailing list