"Keo Sophon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> How to convert a decimal number to hexadecimal, octal and vice versa? The number is stored in binary on the computer so you never convert the number itself, what you convert is the representation of that number as a string. The easiest way (and the one with most control) is to use string formatting: number = 42 print "%X" % number print "%x" % number print "%05x" % number print "%o" % number etc. HTH, -- Alan G Author of the learn to program web tutor http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor