How to: Coordinate DictReader and Reader for CSV

ray ray at aarden.us
Mon Nov 21 08:18:00 EST 2011


I am trying to get the data from a CSV file into variables.  I have
used DictReader to get the field names and I can report them.  When I
attempt to look at the data, every row shows the combination of
fieldname:data.  How do I get the data out?
linelist=open( "C:/Users/rjoseph/Documents/Projects/Bootstrap Plan
Design Tool/Sandbox/line_list_r0a.csv", "rb" )
csvDictReader=csv.DictReader( linelist, dialect='excel' )
for data in csvReader:
        print data[0]
        print data[1]
        print data[2]
        print data[3]
linelist.close()

Thanks,
ray



More information about the Python-list mailing list