hex numbers??

jubafre at brturbo.com jubafre at brturbo.com
Tue Sep 24 11:30:48 EDT 2002

>>> y=hex(x)
>>> y
>>> type(y)
<type 'str'>

the hex() function put the hexadecimal number in a string type like this '0xa', but the real hexadecimal number of 10 is 'a', why python puts a '0x',  and how i can get just the real hexadedcimal number, for example i want to write in a file 10 in hexadecimal, but if i use hex(10) the result is '0xa' as a string, is not the same as 'a'.

'0xa' != 'a'

x = [12,13,14]
y = ['0xc', '0xd', '0xe']

hex() create a list of string,  how i can write in a file just the real value of hexadecimal number?

Juliano Freitas

More information about the Python-list mailing list