Reverse of hex()

Hans Nowak hnowak at cuci.nl
Mon Mar 20 17:59:28 EST 2000


On 20 Mar 00, at 11:43, Gaetan Corneau wrote:

> Hi, 
> 
> I'm looking for the reverse of the hex built-in function: is there any?

You can use eval:

>>> eval('0xf')
15

Or maybe:

>>> string.atoi('0xf', 16)
15

HTH,

--Hans Nowak (zephyrfalcon at hvision.nl)
Homepage: http://www.hvision.nl/~ivnowa/newsite/
Python questions? See http://tor.dhs.org/~zephyrfalcon/snippets
You call me a masterless man. You are wrong. I am my own master.




More information about the Python-list mailing list