PEP 305 - CSV File API

Skip Montanaro skip at pobox.com
Mon Feb 3 16:38:04 CET 2003


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.  On output, the situation is similar.  For some passing
compatibility with the DB-API (which represents SQL NULL values as None),
None is currently being written as the empty string (though this is perhaps
still subject to change).  Other than that, str() is simply called for all
data being written to the file.

Skip





More information about the Python-list mailing list