Answers for "how to add headers in csv file using python"

1

how to add headers in csv file using python

import csv

f = open("fruits.csv", "w")
writer = csv.DictWriter(
    f, fieldnames=["fruit", "count"])
writer.writeheader()
f.close()
Outputfruits.csvfruit,count
Posted by: Guest on September-16-2020

Code answers related to "how to add headers in csv file using python"

Python Answers by Framework

Browse Popular Code Answers by Language