a=0100; print a ; 64 how to reverse this?
horpner at yahoo.com
Tue Jul 17 15:47:17 CEST 2007
On 2007-07-17, mosi <skawanagi at gmail.com> wrote:
> Thank you,
> this is great,
> I thought that this should be standard in python 2.4 or 2.5 or in some
> standard library (math ???)
> Didn`t find anything.
Support is built-in for string representations of numbers in other
than base 10, but conversions to integer is the only support.
You can do:
>>> d = int(s, base).
>>> s = str(d, base)
The % format operator can do hex and octal, I believe.
More information about the Python-list