Created
May 6, 2016 14:25
-
-
Save xtream1101/f9faa2a70501e679106589f04be62550 to your computer and use it in GitHub Desktop.
csv to dict with unicode chars
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
import sys | |
import csv | |
from pprint import pprint | |
row_list = [] | |
with open(sys.argv[1], 'r', encoding='ISO-8859-1') as f: | |
reader = csv.DictReader(f) | |
for row in reader: | |
# Make all keys lower case since we do not know the case used | |
row = dict((k.lower(), v) for k, v in row.items()) | |
row_list.append(row) | |
pprint(row_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment