hex to signed integer

Miki Tebeka tebeka at cs.bgu.ac.il
Thu Jul 17 06:05:31 EDT 2003


Hello Tom,

> I want to convert a string of hexadecimal characters to the signed
> integer they would have been before the <print> statement converted
> them.  How do I do this in such a way that is compatible with Python
> versions 1.5.2 through 2.4, and not machine-dependent?
eval?
e.g.:
>>> eval("0x%s" % "FF")
255

HTH.
Miki




More information about the Python-list mailing list