Hi, On Oct 22, 2012, at 12:20 PM, "Dewhirst, Rob" <robdewhi...@gmail.com> wrote:
> import csv > ifile = open('test.csv', "r") > reader = csv.reader(ifile) > for row in reader: > print row > for row in reader: > print row > ifile.close() > > This is a simplified version of what I am trying to do - loop through > a CSV file twice. Why does the second for loop not execute at all? > The first one prints the rows of the file just fine. > _ I believe csv module uses iterator so you need to run reader.seek(0) between the for loops Laszlo http://twitter.com/LZAntal > ______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor