1import csv
2csv_columns = ['word','matchin']
3
4csv_file = "found.csv"
5try:
6 with open(csv_file, 'w') as csvfile:
7 writer = csv.DictWriter(csvfile, fieldnames=csv_columns)
8 writer.writeheader()
9 for data in corpus:
10 writer.writerow(data)
11except IOError:
12 print("I/O error")
1 pythonCopyimport csv
2
3mydict = {}
4
5with open('csv_file.csv', mode='r') as inp:
6 reader = csv.reader(inp)
7 dict_from_csv = {rows[0]:rows[1] for rows in reader}
8
9print(dict_from_csv)
10