xxxxxxxxxx
import csv
my_dict = {'1': 'aaa', '2': 'bbb', '3': 'ccc'}
with open('test.csv', 'w') as f:
for key in my_dict.keys():
f.write("%s,%s\n"%(key,my_dict[key]))
xxxxxxxxxx
import pandas as pd
dict_from_csv = pd.read_csv('csv_file.csv', header=None, index_col=0, squeeze=True).to_dict()
print(dict_from_csv)
xxxxxxxxxx
mydict = {y[0]: y[1] for y in [x.split(",") for x in open('file.csv').read().split('\n') if x]}