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

Question on the "csv" library

2009-08-27 Thread vsoler
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 <_csv.reader object at 0x01022E70> >>> for row in spamRe

Re: Source code for csv module

2009-02-02 Thread vsoler
On 2 feb, 21:51, Jon Clements wrote: > On 2 Feb, 20:46, vsoler wrote: > > > Hi you all, > > > I just discovered the csv module here in the comp.lang.python group. > > > I have found its manual, which is publicly available, but since I am > > still a newby, lea

Source code for csv module

2009-02-02 Thread vsoler
Hi you all, I just discovered the csv module here in the comp.lang.python group. I have found its manual, which is publicly available, but since I am still a newby, learning techniques, I was wondering if the source code for this module is available. Is it possible to have a look at it? Thanks

Re: getting values from a text file (newby)

2009-02-01 Thread vsoler
On 1 feb, 23:57, John Machin wrote: > On Feb 2, 6:18 am, vsoler wrote: > > > > > r: in the open statement, why do you use 'rb' as 2nd argument? b is > > supposed to be binary, and my file is text! > > Because unlike Stephen, r has read the csv manual. Bina

Re: getting values from a text file (newby)

2009-02-01 Thread vsoler
On 1 feb, 19:02, Stephen Hansen wrote: > On Sun, Feb 1, 2009 at 9:24 AM, vsolerwrote:Hi, > My foo.txt file contains the following: > 1,"house","2,5" > 2,"table","6,7" > 3,"chair","-4,5" > ... as seen with notepad. > This file was created with the OpenOffice Calc spreadsheet, but since > I use comm

getting values from a text file (newby)

2009-02-01 Thread vsoler
Hi, My foo.txt file contains the following: 1,"house","2,5" 2,"table","6,7" 3,"chair","-4,5" ... as seen with notepad. This file was created with the OpenOffice Calc spreadsheet, but since I use comma as the decimal separator for numbers, the last value in each line appears sorrounded by quotes

Re: Newby: how to transform text into lines of text

2009-01-25 Thread vsoler
On 25 ene, 14:36, "Diez B. Roggisch" wrote: > vsoler schrieb: > > > Hello, > > > I'va read a text file into variable "a" > > >      a=open('FicheroTexto.txt','r') > >      a.read() > > > "a" cont

Newby: how to transform text into lines of text

2009-01-25 Thread vsoler
Hello, I'va read a text file into variable "a" a=open('FicheroTexto.txt','r') a.read() "a" contains all the lines of the text separated by '\n' characters. Now, I want to work with each line separately, without the '\n' character. How can I get variable "b" as a list of such lines?

<    1   2