[Tutor] newb help reading lines from csv

Matt Williams mhw at doctors.org.uk
Mon Oct 22 21:27:45 CEST 2012

Dear Rob,

This caught me out as well for a long time.

As I understand it, csv.reader is a file-reader, which iterates ONCE 
over the file. There may be more elegant solutions, but I do:

import csv
ifile = open('test.csv', "r")
reader = csv.reader(ifile)
inData = []
for row in reader:

you can now loop through inData to your heart's desire.



More information about the Tutor mailing list