sorting items in a table problematic because of scientific notation

John Machin sjmachin at lexicon.net
Wed Apr 29 16:09:11 CEST 2009


On 29/04/2009 11:33 PM, skip at pobox.com wrote:
>     >> Thanks.  Didn't used to be that way I don't think.
> 
>     Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
>     Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>     >>> float('    1.23456789e+004   ')
>     12345.6789
> 
>     John> :-)
> 
> Maybe string.ato[if] used to behave that way?

Nope.

   Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
   Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
   >>> import string
   >>> string.atof('    1.234567    ')
   1.234567
   >>> string.atoi('    1234567    ')
   1234567
   >>>





More information about the Python-list mailing list