Converting hex to char help
Tim Chase
python.list at tim.thechases.com
Sun May 14 16:01:29 EDT 2006
> How can I convert a string "0x62" to int/hex without this problem?
The call to int() takes an optional parameter for the base:
>>> print int.__doc__
int(x[, base]) -> integer
Convert a string or number to an integer, if possible. A
floating point argument will be truncated towards zero (this
does not include a string representation of a floating point
number!) When converting a string, use the optional base.
It is an error to supply a base when converting a
non-string. If the argument is outside the integer range a
long object will be returned instead.
>>> int('0x62', 16)
98
-tkc
More information about the Python-list
mailing list