Here is my code:
import csv reader = csv.reader(open('new_file.txt','r'),delimiter=' ') row1 = reader[0] row2 = reader[1] row3 = reader[2]
Here is my new_file.txt :
this is row one this is row two this is row three
When I launched it, I have the following error:
Traceback (most recent call last): File "/home/me/Documents/folder/file.py", line 211, in <module> row1 = reader[0] TypeError: '_csv.reader' object has no attribute '__getitem__'
How can i fix this?
Thanks.
source share