Integer conversion

holger krekel pyth at devel.trillke.net
Sat Jun 15 08:44:43 EDT 2002


Colin J. Williams wrote:
> int(string, base) => integer
> 
> For int('127',  8), I had expected this function to deliver 87.

with python2.1/2.2/2.3

>>> int('127',8)
87

> The example below correctly gives errors at the top and bottom of the
> range and
> for int('127', 10) delivers 127.  The other cases are not what I
> expected.

IMO they work very nicely. Please copy the EXACT screen session
so we can help.

    holger





More information about the Python-list mailing list