Reading a comma delimited file

Kristen Zander kzander at hot.rr.com
Thu Nov 8 12:46:56 EST 2001


Well, I thought I had it but the last thing I did with the fpformat made
them string again.

Does the %f work just like in C?

%.2f,var

Skip Montanaro <montanaro at tttech.com> wrote in message
news:mailman.1005235753.29219.python-list at python.org...
>
>     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