Question on the "csv" library

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Aug 28 19:02:32 CEST 2009


En Fri, 28 Aug 2009 13:35:19 -0300, vsoler <vicente.soler at gmail.com>  
escribió:

> On Aug 28, 5:43 pm, Steven Rumbalski <googleacco... at rumbalski.com>
> wrote:
>> On Aug 27, 3:06 pm, vsoler <vicente.so... at gmail.com> wrote:

>> > I am trying to read a csv file generated by excel.
>> > ['a;qwe;1']
>> > ['b;asd;2']
>> > ['c;zxc;3']
>
> Thank you very much for all your comments. After reading them I can
> conclude that:
>
> 1- the CSV format is not standardized; each piece of software uses it
> differently

Yes! And that's part of the pain of working with 'csv' files.

> 2- the "C" in "CSV" does not mean "comma" for Microsoft Excel; the ";"
> comes from my regional Spanish settings

Yes - but not just Excel, other programs do call "CSV" files that are  
TAB-separated, by example.

> 3- Excel does not even put quotes around litteral texts, not even when
> the text contains a blank

I guess you'll get quotes around text containing ';' characters

> But, perhaps, there is no standard alternative to CSV !!!

Of course there are! You may use SYLK, DIFF, XML, XDR...

"The nice thing about standards is that there are so many to choose from."  
(Andrew S. Tanenbaum)

But look for the xlrd package, it lets you read Excel files directly from  
Python.

-- 
Gabriel Genellina




More information about the Python-list mailing list