import csv
with open('employee_file2.csv', 'w') as csv_file:
fieldnames = ['emp_name', 'dept', 'birth_month']
writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
writer.writeheader()
writer.writerow({'emp_name': 'John Smith', 'dept': 'Accounting', 'birth_month': 'November'})
writer.writerow({'emp_name': 'Erica Meyers', 'dept': 'IT', 'birth_month': 'March'})
!cat employee_file2.csv
emp_name,dept,birth_month John Smith,Accounting,November Erica Meyers,IT,March
import csv
with open('employee_file.csv', 'w') as employee_file:
employee_writer = csv.writer(employee_file)
employee_writer.writerow(['John Smith', 'Accounting', 'November'])
employee_writer.writerow(['Erica Meyers', 'IT', 'March'])
!cat employee_file.csv
John Smith,Accounting,November Erica Meyers,IT,March
# https://realpython.com/python-csv/