Skip to content

Instantly share code, notes, and snippets.

@CamDavidsonPilon
Created December 30, 2018 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CamDavidsonPilon/243c39a0c4ae028d7ee1c5f4d8194ba0 to your computer and use it in GitHub Desktop.
Save CamDavidsonPilon/243c39a0c4ae028d7ee1c5f4d8194ba0 to your computer and use it in GitHub Desktop.
import csv
from collections import defaultdict
d = defaultdict(dict)
with open('lexicon_3.csv') as dict_:
csv_reader=csv.reader(dict_, delimiter=',')
for row in csv_reader:
d[row[0]][row[1]] = int(row[2])
print(len(d))
print(d['happy'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment