Skip to content

Instantly share code, notes, and snippets.

@n1k0
Created June 21, 2010 12:44
Show Gist options
  • Save n1k0/446795 to your computer and use it in GitHub Desktop.
Save n1k0/446795 to your computer and use it in GitHub Desktop.
## This script will map a standard CSV file to a python list containing a dict for each row
import csv
reader = csv.reader(open('foobar.csv'), delimiter=',', quotechar='"')
fields = reader.next() # field names are in the first line
results = []
for row in reader:
results.append(dict(zip(fields, row)))
for result in results:
print "%s: %s" % (result['Level'], result['Description'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment