Skip to content

Instantly share code, notes, and snippets.

@boffbowsh
Created February 10, 2015 09:57
Show Gist options
  • Save boffbowsh/ed86411da6b09ac35180 to your computer and use it in GitHub Desktop.
Save boffbowsh/ed86411da6b09ac35180 to your computer and use it in GitHub Desktop.
KEY_COLUMN = 2
with csv.reader(f1) as csv1:
d1 = {r[KEY_COLUMN]: r for r in csv1}
with csv.reader(f2) as csv2:
d2 = {r[KEY_COLUMN]: r for r in csv2}
merged_dict = {x:d1[x] for x in d1 if x in d2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment