Answers for "python read csv to dict"

0

csv library python convert dict to csv

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,%sn"%(key,my_dict[key]))
Posted by: Guest on August-24-2021

Python Answers by Framework

Browse Popular Code Answers by Language