String to Hex
Oliver Fromme
olli at haluter.fromme.com
Fri Oct 29 12:59:55 EDT 2004
Michael Foord <fuzzyman at gmail.com> wrote:
> How do you safely turn an arbitrarily long signed hex string into a
> long integer ?
> e.g. -0x55aff8080000
I don't really see what the problem is.
$ python -c 'print int("-0x55aff8080000", 16)'
-94214268911616
Works fine on 2.3.4, no warning. The "0x" is optional,
so if your strings don't contain it from the beginning,
you don't have to insert it.
Best regards
Oliver
--
Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany
``All that we see or seem is just a dream within a dream.''
(E. A. Poe)
More information about the Python-list
mailing list