[Python-Dev] (no subject)
dan.gass at gmail.com
Sat Jun 19 12:15:08 EDT 2004
> if you had a hex string like
> how would you convert it to an int?
> int(0x7c) works, but not int('0x7c')
The general python mailing list is a more appropriate place for this
question. That being said, what you are looking for is
int('0x7c',16). FYI int('7c',16) also works. This can be found in
the Python manual (that came with Python) in the Python Library
Reference section 2.1 Built in functions. You may want to scan
through the tutorial and the library reference material as they both
are good places to look to answer questions like this.
More information about the Python-Dev