I have a CSV file with about 2000 records.
Each record has a string, and a category to it:
This is the firs
import csv
from pprint import pprint
with open('text.csv', newline='') as file:
reader = csv.reader(file)
res = list(map(tuple, reader))
pprint(res)
Output:
[('This is the first line', ' Line1'),
('This is the second line', ' Line2'),
('This is the third line', ' Line3')]
If csvfile is a file object, it should be opened with newline=''
.
csv module