Re: Question on the "csv" library

2009-08-28 Thread John Machin
On Aug 29, 2:35 am, vsoler wrote: > 3- Excel does not even put quotes around litteral texts, not even when > the text contains a blank Correct. Quoting is necessary only if a text field contains a delimiter (semicolon/comma), a newline, or the quote character. You can read Excel CSV output usin

Re: Question on the "csv" library

2009-08-28 Thread Hrvoje Niksic
David Smith writes: >> 2- the "C" in "CSV" does not mean "comma" for Microsoft Excel; the ";" >> comes from my regional Spanish settings > > The C really does stand for comma. I've never seen MS spit out > semi-colon separated text on a CSV format. That's because you're running MS Office in a U

Re: Question on the "csv" library

2009-08-28 Thread Mark Lawrence
vsoler wrote: On Aug 28, 5:43 pm, Steven Rumbalski wrote: On Aug 27, 3:06 pm, vsoler wrote: I am trying to read a csv file generated by excel. Although I succeed in reading the file, the format that I get is not suitable for me. I've done: import csv spamReader = csv.reader(open('C:\\abc.

Re: Question on the "csv" library

2009-08-28 Thread David Smith
vsoler wrote: > > 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 True, but there are commonalities. See http://en.wikipedia.org/wiki/Comma-separated_values > > 2- the

Re: Question on the "csv" library

2009-08-28 Thread Gabriel Genellina
En Fri, 28 Aug 2009 13:35:19 -0300, vsoler escribió: On Aug 28, 5:43 pm, Steven Rumbalski wrote: On Aug 27, 3:06 pm, vsoler 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 th

Re: Question on the "csv" library

2009-08-28 Thread vsoler
On Aug 28, 5:43 pm, Steven Rumbalski wrote: > On Aug 27, 3:06 pm, vsoler wrote: > > > > > I am trying to read a csv file generated by excel. > > > Although I succeed in reading the file, the format that I get is not > > suitable for me. > > > I've done: > > > >>> import csv > > >>> spamReader = c

Re: Question on the "csv" library

2009-08-28 Thread Steven Rumbalski
On Aug 27, 3:06 pm, vsoler wrote: > I am trying to read a csv file generated by excel. > > Although I succeed in reading the file, the format that I get is not > suitable for me. > > I've done: > > >>> import csv > >>> spamReader = csv.reader(open('C:\\abc.csv', 'r')) > >>> print spamReader > > <_

Re: Question on the "csv" library

2009-08-28 Thread Andreas Waldenburger
On Fri, 28 Aug 2009 09:03:49 +0100 Mark Lawrence wrote: > p.s. is it "separator" or "seperator", after 50+ years I still can't > remember? The former. It's cognate to English "part" if that helps any. /W -- INVALID? DE! -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on the "csv" library

2009-08-28 Thread Mark Lawrence
John Machin wrote: On Aug 28, 6:44 am, Mark Lawrence wrote: vsoler wrote: On Aug 27, 9:42 pm, Andreas Waldenburger 1- the csv file was generated with Excel 2007; no prompts for what the separator should be; Excel has used ";" by default, without asking anything I find this difficult to belie

Re: Question on the "csv" library

2009-08-27 Thread Simon Brunning
2009/8/28 John Machin : > > Mark, there exist parallel universes the denizens of which use strange > notation e.g. 1.234,56 instead of 1,234.56 When displaying data, sure. > and would you believe they > use ';' instead of ',' as a list separator ... CSV is a data transfer format, not a display f

Re: Question on the "csv" library

2009-08-27 Thread John Machin
On Aug 28, 6:44 am, Mark Lawrence wrote: > vsoler wrote: > > On Aug 27, 9:42 pm, Andreas Waldenburger > > > 1- the csv file was generated with Excel 2007; no prompts for what the > > separator should be; Excel has used ";" by default, without asking > > anything > > I find this difficult to belie

Re: Question on the "csv" library

2009-08-27 Thread Mark Lawrence
vsoler wrote: On Aug 27, 9:42 pm, Andreas Waldenburger wrote: On Thu, 27 Aug 2009 21:36:28 +0200 Andreas Waldenburger wrote: [snip] Might I humbly suggest sheet = list(spamReader) # ? Oh, and while I'm humbly suggesting: spam_reader instead of spamReader or SpamReader or SpamrEadeR or su

Re: Question on the "csv" library

2009-08-27 Thread Andreas Waldenburger
On Thu, 27 Aug 2009 13:12:07 -0700 (PDT) vsoler wrote: > On Aug 27, 9:42 pm, Andreas Waldenburger > wrote: > > [snip what I wrote] > > Thank you for your answers. Let me however make some comments: > > 1- the csv file was generated with Excel 2007; no prompts for what the > separator should b

Re: Question on the "csv" library

2009-08-27 Thread vsoler
On Aug 27, 9:42 pm, Andreas Waldenburger wrote: > On Thu, 27 Aug 2009 21:36:28 +0200 Andreas Waldenburger > > wrote: > > [snip] > > > Might I humbly suggest > > > >>> sheet = list(spamReader)  # ? > > Oh, and while I'm humbly suggesting: > > spam_reader instead of spamReader or SpamReader or Spam

Re: Question on the "csv" library

2009-08-27 Thread Andreas Waldenburger
On Thu, 27 Aug 2009 21:36:28 +0200 Andreas Waldenburger wrote: > [snip] > > Might I humbly suggest > > >>> sheet = list(spamReader) # ? > Oh, and while I'm humbly suggesting: spam_reader instead of spamReader or SpamReader or SpamrEadeR or suchlike. Caps are "reserved" for classes. Not a ne

Re: Question on the "csv" library

2009-08-27 Thread Benjamin Kaplan
On Thu, Aug 27, 2009 at 3:06 PM, vsoler wrote: > > I am trying to read a csv file generated by excel. > > Although I succeed in reading the file, the format that I get is not > suitable for me. > > I've done: > > >>> import csv > >>> spamReader = csv.reader(open('C:\\abc.csv', 'r')) > > >>> print