Conversion to Hex or other bases

??? gslee111 at daisy.kwangwoon.ac.kr
Sun Mar 19 23:42:54 CET 2000


You can get hex or octal string from a decimal number using

1. hex() function :   hex(23)
2. 'formatted string' : hex = "%x" % 23

both gives you '0x17'

Gang

"Gerhard Gruber" <sparhawk at aon.at> wrote in message
news:gsjads40dsuo2jbgokhrbktndkdkhk85jg at 4ax.com...
> How can I convert a decimal to another base? i.e. Hex or binary?
>
> --
> Bye,
>    Gerhard
> If you are programming dynamic HTML in python you might find 'template.py'
> usefull. Look at my homepage: http://members.aon.at/sparhawk





More information about the Python-list mailing list