Couldn't get what wrong in the code, as csv
module has a csv.reader()
function as per the documentation. But I am still getting this error:
Traceback (most recent call last):
File "test_csv.py", line 4, in <module>
read = csv.reader(csv, delimiter = ',')
AttributeError: '_io.TextIOWrapper' object has no attribute 'reader'
My code:
import csv
with open('test_csv.csv') as csv:
read = csv.reader(csv, delimiter = ',')
for row in read:
print(row)