I want to write a specific python dictionary to csv with header. I have looked at other questions but none of them have the similar dictionary structure as mine:
myDic = { "a" : 1, "b" : 2, "c" : 15}
header = ["word", "count"]
with open('myFile.csv', 'w', encoding='utf-8-sig') as f:
w = csv.DictWriter(f, header)
w.writeheader()
w.writerow(myDic)
What I got is only word,count in my CSV file. I am using python 3.