read csv file and display in table python code example
Example 1: python read 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
Example 2: system to extract data from csv file in python
#import necessary modules
import csv
with open('X:\data.csv','rt')as f:
data = csv.reader(f)
for row in data:
print(row)