When reading a CSV, instead of skipping the first line (header), and reading row items by number:
with open('info.csv') as f:
reader = csv.reader(f, delimiter=';')
next(reader, None)
for row in reader:
name = row[0]
blah = row[1]
is there a built-in way to access row items by making use of the header line? Something like:
with open('info.csv') as f:
reader = csv.reader(f, delimiter=';', useheader=True)
for row in reader:
name = row['name']
blah = row['blah']
where info.csv
has a header line:
name;blah
John;Hello2
Mike;Hello2