sorting a list numbers stored as strings
Delaney, Timothy (Tim)
tdelaney at avaya.com
Tue Sep 25 00:46:54 EDT 2007
Carsten Haese wrote:
> On Mon, 2007-09-24 at 19:58 +0800, Delaney, Timothy (Tim) wrote:
>> I'm sure that in some version of Python it would have given a
>> ValueError (due to the default radix being 0) but it appears to have
>> changed to a default radix of 10 somewhere along the way.
>
> Not even Python 1.5.2 seems to have a problem with leading zeroes:
>
> Python 1.5.2 (#1, Nov 6 1999, 14:53:40) [C] on sco_sv3
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>>> int("08")
> 8
Yep - appears I must have been misremembering from another language
(dunno which) or I misinterpreted the docs.
In any case, the docs have been made explicit about the situation now.
Tim Delaney
More information about the Python-list
mailing list