import csv with open(fpath, 'r') as infile: reader = csv.DictReader(infile) fieldnames = reader.fieldnames