python csv headers code example
Example: 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
import csv
f = open("fruits.csv", "w")
writer = csv.DictWriter(
f, fieldnames=["fruit", "count"])
writer.writeheader()
f.close()
Outputfruits.csvfruit,count