csv module
import csv
data = [
['John', 25],
['Mary', 30],
['Robert', 42],
]
with open('test.csv', mode='w', newline='') as file:
csvWriter = csv.writer(file)
for item in data:
csvWriter.writerow(item)
import csv
data = [
['John', 25],
['Mary', 30],
['Robert', 42],
]
with open('test.csv', mode='w', newline='') as file:
csvWriter = csv.writer(file)
for item in data:
csvWriter.writerow(item)
Leave a Comment
Cancel reply