Conversion to Hex or other bases

??? gslee111 at
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'


"Gerhard Gruber" <sparhawk at> wrote in message
news:gsjads40dsuo2jbgokhrbktndkdkhk85jg at
> 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 ''
> usefull. Look at my homepage:

More information about the Python-list mailing list