Created
June 21, 2010 12:44
-
-
Save n1k0/446795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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