hex to signed integer

Tom Goulet tomg at em.ca
Thu Jul 17 12:52:10 EDT 2003


Miki Tebeka wrote:

> eval?
> e.g.:
>>>> eval("0x%s" % "FF")
> 255

| >>> eval("0x"+"B2DE7282", {}, {})
| <string>:0: FutureWarning: hex/oct constants > sys.maxint will return \
| 	positive values in Python 2.4 and up
| -1294044542

There you have it.  Using the <eval> function doesn't work on 2.4 and
using the <int> function doesn't work on 1.5.2.  Besides, I want to
avoid use of the <eval> function.

-- 
Tom Goulet, tomg at em.ca, D8BAD3BC, http://web.em.ca/~tomg/contact.html




More information about the Python-list mailing list