How To write List Of Lists Into csv using Writer ,writerows function using python 3?.

import csv
csvData = [['Person', 'Age'], ['Peter', '22'], ['Jasmine', '21'], ['Sam', '24']]
with open('sreedhar.csv', 'w') as csvFile:
writer = csv.writer(csvFile)
writer.writerows(csvData)
csvFile.close()

Leave a Reply

Your email address will not be published. Required fields are marked *