1# This action requires the 'csv' module
2import csv
3
4# The basic usage is to first define the rows of the csv file:
5row_list = [["SN", "Name", "Contribution"],
6 [1, "Linus Torvalds", "Linux Kernel"],
7 [2, "Tim Berners-Lee", "World Wide Web"],
8 [3, "Guido van Rossum", "Python Programming"]]
9
10# And then use the following to create the csv file:
11with open('protagonist.csv', 'w', newline='') as file:
12 writer = csv.writer(file)
13 writer.writerows(row_list)
14# This will create a csv file in the current directory
1import csv
2with open(<path to output_csv>, "wb") as csv_file:
3 writer = csv.writer(csv_file, delimiter=',')
4 for line in data:
5 writer.writerow(line)
6