[EMAIL PROTECTED] wrote:

>tim wrote:
>  
>
>>but then i get :
>>
>> >>> m
>>66
>> >>> n=int(hex(m))
>>Traceback (most recent call last):
>>  File "<interactive input>", line 1, in ?
>>ValueError: invalid literal for int(): 0x42
>> >>>
>>
>>what am I missing here ?
>>    
>>
>
>Avnit's solution was wrong. When converting a string, you
>must state what base you are converting from.
>
>  
>
>>>>int(hex(m),16)
>>>>        
>>>>
>66
>
>Fredrik Lundh's solution works if the hex string starts with "0x"
>(which it will when the string is created with the hex function).
>
>  
>
aren't you converting from a hex string to a decimal value here?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to