Converting a hex string to an integer

Adrian Eyre a.eyre at optichrome.com
Tue Apr 4 09:40:33 EDT 2000


> >>> import string
> >>> string.atoi("0xab", 0)
> 171
> 
> or in 1.6:
> 
> >>> int("0xab", 0)
> 171

or (probably available since v1.0):

>>> eval("0xab")
171

#include <UsualEvalWarnings.h>

-----------------------------------------------------------------
Adrian Eyre <a.eyre at optichrome.com> - http://www.optichrome.com 





More information about the Python-list mailing list