[EMAIL PROTECTED] wrote:
> Hello,
> 
> I use csv to take information from file.
> import csv
> reader = csv.reader(open('t.csv'))
> 
> for row in reader:
>     print row # it is perfectly OK
> 
> ---------------------------------------------------------------------
> But If I use this code I have problem
> import csv
> reader = csv.reader(open('t.csv'))
> 
> for row in reader:
>     print row # it is perfectly OK
> for row in reader:
>     print row # it is not printed on the monitor???
> 
> Why does only the first print row work here?
> 
> TIA,
> ajikoe
> 

Because reader is an iterator and has no means of going back to its
beginning.

You could make a list out of it:
lines = list(csv.reader(open('t.csv')))
for row in lines:
  print row
for row in lines:
  print row

Hope it helps,

Cameron.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to