Reading a comma delimited file

Skip Montanaro montanaro at tttech.com
Thu Nov 8 17:08:32 CET 2001


    Kristen> Here's what it looks like when I'm done:

    Kristen> [('Cotulla',  28.449999999999999,  99.216700000000003,  1960.0,  2.0,  11.1,
    Kristen> 20.0,  0.0,  167.30000000000001),
    Kristen>  ('Cotulla',  28.449999999999999,  99.216700000000003,  1960.0,  3.0,
    Kristen> 6.0999999999999996,  13.9,  0.0,  239.0)]

    Kristen> Just what I need except I don't want all those decimal places.

You're being victimized by floating point (im)precision.  Details here:

    http://python.sourceforge.net/devel-docs/tut/node14.html
    http://www.python.org/cgi-bin/faqw.py?req=show&file=faq04.098.htp

-- 
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list