Is anyone happy with csv module?

Neil Cerutti horpner at yahoo.com
Wed Dec 12 13:36:28 EST 2007


On 2007-12-12, Shane Geiger <sgeiger at ncee.net> wrote:
> Neil Cerutti wrote:
>> On 2007-12-12, je.s.te.r at hehxduhmp.org <je.s.te.r at hehxduhmp.org> wrote:
>>   
>>> John Machin <sjmachin at lexicon.net> wrote:
>>>     
>>>> For that purpose, CSV files are the utter pox and then some.
>>>> Consider using xlrd and xlwt (nee pyexcelerator) to read
>>>> (resp. write) XLS files directly.
>>>>       
>>> FWIW, CSV is a much more generic format for spreadsheets than
>>> XLS. For example, I deal almost exclusively in CSV files for
>>> simialr situations as the OP because I also work with software
>>> that can't (or in some cases "can't easily") deal with XLS
>>> files.  CSV files can be read in by basically anything.
>>>     
>>
>> When I have a choice, I use simple tab-delimited text files.  The
>> usually irrelevent limitation is the inability to embed tabs or
>> newlines in fields. The relevant advantage is the simplicity.
>>   
>
> That is very unnecessary.  You can have your tabs and not eat them, too:
>
>
>
> #!/usr/bin/python
> """
> EXAMPLE USAGE OF PYTHON'S CSV.DICTREADER FOR PEOPLE NEW TO
> PYTHON AND/OR CSV.DICTREADER

I gladly use the csv module to generate valid csv data for others
or for myself. But I'm no longer comfortable using just anyone's
csv export feature. A commercial product I use every day creates
invalid csv files. How many more products have tried to "roll
their own" and botched it horribly? I wish more apps embedded
Python. ;-)

Thanks for posting the example code.

-- 
Neil Cerutti
You've got to take the sour with the bitter. --Samuel Goldwyn



More information about the Python-list mailing list