Skip to content

Instantly share code, notes, and snippets.

@xtream1101
Created May 6, 2016 14:25
Show Gist options
  • Save xtream1101/f9faa2a70501e679106589f04be62550 to your computer and use it in GitHub Desktop.
Save xtream1101/f9faa2a70501e679106589f04be62550 to your computer and use it in GitHub Desktop.
csv to dict with unicode chars
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