On Wed, April 5, 2006 5:02 pm, Keo Sophon wrote:
> Hi,
>
> How to convert a decimal number to hexadecimal, octal and vice versa?

>>> foo = 2
>>> str(foo) # Integer to string
'2'
>>> oct(15)  # Integer to octal
'017'
>>> hex(15)  # Integer to hex
'0xf'
>>> int(0xf) # Hex to decimal integer


-- 
-NI

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to