⇤ ← Revision 1 as of 2004-11-11 15:42:52
613
Comment:
|
786
|
Deletions are marked like this. | Additions are marked like this. |
Line 16: | Line 16: |
["lwickjr"]: you use >>> print int('0a', 16) 10 >>> ...but these aren`t hex values. Try ord() on each character, and see if that gives you the results you need. |
Converting a Hex representation to an Integer
I'm running into some trouble when trying to convert a series of hex representations into an integer... I'm sure there is a builtin to do this (wouldn't make sense not to have one) but I can't find it for the life of me.
This is a dump of my interpreter session:
and I need to convert the values following user ('\x00\xcc\x15\xa4') into an integer value... what am I doing wrong here?
["lwickjr"]: you use
>>> print int('0a', 16) 10 >>>
...but these aren`t hex values. Try ord() on each character, and see if that gives you the results you need.