CSV in Python

To open csv files in python we need to import csv module first then create an empty list. write below code to open csv file and append data to csv.

import os
c=[]
with open('Location of file/ test block.csv', mode ='r')as file:
csvfile = csv.reader(file)
for lines in csvfile:
c.append(lines)

mode=’r’ represent read mode.

By SC

Leave a Reply

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