PEP 305 - CSV File API
sjmachin at lexicon.net
Mon Feb 3 21:33:25 CET 2003
Skip Montanaro <skip at pobox.com> wrote in message news:<mailman.1044286748.16616.python-list at python.org>...
> I think I have the attributions right.
> Carlos> that happen to be problematic, and that are locale-related:
> Carlos> - reading dates from a CSV file
> JohnM> Certainly dates are a problem ... however, in what way is reading
> JohnM> dates from a CSV-format file any different to reading them from
> JohnM> any other format?
> JohnR> It's not particularly different. What is needed is the ability to
> JohnR> associate the necessary parameters with a date column to do the
> JohnR> application dependent "correct" transformation, based on the
> JohnR> available date libraries.
> I will note that the csv module under development makes *no* attempts at any
> kind of data conversion when reading CSV files. Even ints and floats are
> returned as strings. It's left up to the application programmer to perform
> type conversions.
And this is as it should be. In fact, "Even ints and floats are
returned as strings" would be better expressed as "Even if it might
appear to the casual observer that fields contain character strings
that probably represent int or float values, those values are returned
as Python strings; the module under discussion should not care about
the semantics of those strings".
Anybody who wants "00012345", "00098765" interpreted as
int("00012345"), int("00098765") should stick with Excel. No guessing,
More information about the Python-list