import csv f = open("fruits.csv", "w") writer = csv.DictWriter( f, fieldnames=["fruit", "count"]) writer.writeheader() f.close() Outputfruits.csvfruit,count