import a csv into a dictionary with column names as keys and the rest of the row as the value python code example
Example: accessing elements in DictReader
import csv
input_file = csv.DictReader(open("people.csv"))
max_age = None
oldest_person = None
for row in input_file:
age = int(row["age"])
if max_age == None or max_age < age:
max_age = age
oldest_person = row["name"]
if max_age != None:
print "The oldest person is %s, who is %d years old." % (oldest_person, max_age)
else:
print "The file does not contain any people."