Re: List index out of range, but list has enough elements

2010-11-09 Thread Stefan Behnel
[rearranged the responses in the right order] Costin Gamenț, 09.11.2010 11:44: On Tue, Nov 9, 2010 at 3:21 PM, Costin Gamenț wrote: On Tue, Nov 9, 2010 at 11:33 AM, Stefan Behnel wrote: Costin Gamenț, 09.11.2010 10:24: Hi, I am trying to read a string as csv, but I encountered an odd problem.

Re: List index out of range, but list has enough elements

2010-11-09 Thread Costin Gamenț
Thank you all for your interest in my problem. As Peter pointed out, there was one row with zero elements in it and that's where my problem was (of course it was the very last row, hence my confidence I have "good" data). Have a nice one, Costin On Tue, Nov 9, 2010 at 12:02 PM, Nitin Pawar wrote

Re: List index out of range, but list has enough elements

2010-11-09 Thread Nitin Pawar
You may want to try a spilt if you are getting 8 different elements then it will give you a list of those elements On Tue, Nov 9, 2010 at 3:21 PM, Costin Gamenț wrote: > Thank you for your timely response. Yes, I am sure "i" and "j" are > from the same iteration. I should point out that "i" actua

Re: List index out of range, but list has enough elements

2010-11-09 Thread Costin Gamenț
Thank you for your timely response. Yes, I am sure "i" and "j" are from the same iteration. I should point out that "i" actually has 8 elements and that str(i) gives a nice printout. On Tue, Nov 9, 2010 at 11:33 AM, Stefan Behnel wrote: > Costin Gamenț, 09.11.2010 10:24: >> >> Hi, I am trying to

Re: List index out of range, but list has enough elements

2010-11-09 Thread Peter Otten
Costin Gamenț wrote: > Hi, I am trying to read a string as csv, but I encountered an odd > problem. Here's my code: > > csvfile = csv.reader(datastr.split('\n'), delimiter=';') > r = '' > for i in csvfile: > for j in i: > print j >

Re: List index out of range, but list has enough elements

2010-11-09 Thread Stefan Behnel
Costin Gamenț, 09.11.2010 10:24: Hi, I am trying to read a string as csv, but I encountered an odd problem. Here's my code: csvfile = csv.reader(datastr.split('\n'), delimiter=';') r = '' for i in csvfile: for j in i: print j

List index out of range, but list has enough elements

2010-11-09 Thread Costin Gamenț
Hi, I am trying to read a string as csv, but I encountered an odd problem. Here's my code: csvfile = csv.reader(datastr.split('\n'), delimiter=';') r = '' for i in csvfile: for j in i: print j print i[0] the "print j"