string.atoi and string.atol broken?
DoubleMPi at Netscape.com
Tue Jan 25 20:06:22 EST 2005
Dennis Benzinger wrote:
> Just out of curiosty:
> What did you think what atoi does?
> I don't understand how you came to expect that atoi('4',3)
> should result in 11.
Mea culpa. For some strange reason, I had it in my mind that atoi would
take a base ten number as a string and convert it to the correct
representation in the base of the second argument. In other words,
atoi('4',3) should take 4 in base 10 and convert it to base 3, resulting
in 11. Exactly backwords, as atoi('11',3) = 4, that is, 11 base 3 = 4
Thanks to all for setting me straight.
More information about the Python-list