Python - Structured Data Files
What is the issue with this code snippet?
import csv
with open('data.csv', 'w', newline='') as f:
writer = csv.DictWriter(f, fieldnames=['name', 'age'])
writer.writerow({'name': 'John', 'age': 28})
writer.writeheader()