hex string to hex value

tim tim.vets at skynet.be
Tue Nov 22 18:15:15 EST 2005


This is probably another newbie question...but...
even after reading quite some messages like '..hex to decimal', 
'creating a hex value' , I can't figure this out:
If i do
 >>> m=66
 >>> n=hex(m)
 >>> n
'0x42'
i cannot use n as value for a variable that takes hex values, because it 
throws:

error: required argument is not an integer

 >>> int(n)
gives me:
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
ValueError: invalid literal for int(): 0x42

how do I convert '0x42' to 0x42 ?

thanks!




More information about the Python-list mailing list