pythone csv

>>> import csv
>>> with open('eggs.csv', newline='') as csvfile:
...     spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
...     for row in spamreader:
...         print(', '.join(row))
Spam, Spam, Spam, Spam, Spam, Baked Beans
Spam, Lovely Spam, Wonderful Spam

Here is what the above code is Doing:
1. The first line tells Python to open the eggs.csv file and create a file object called csvfile.
2. The second line creates a variable called spamreader that is assigned to the csv.reader() function.
3. The csv.reader() function needs a file object, and open() returns a file object.
4. The delimiter keyword argument tells the csv.reader() function that the characters in between the commas are to be ignored.
5. The quotechar keyword argument tells the csv.reader() function that double-quote characters are to be treated as normal characters and not as something special.
6. The for loop iterates through each row in the file object and prints out the row.
7. The join() method is called on a comma string, and it returns a new string that is the concatenation of the strings in the sequence.
8. The print() function outputs the contents of the string variable row.