I am trying to read a csv file in python. The csv file has 1400 rows. I opened the csv file using the following command:
import csv
import sys
f=csv.reader(open("/Users/Brian/Desktop/timesheets_9_1to10_5small.csv","rU"),
dialect=csv.excel_tab)
Then I tried to loop through the file to pull the first name from each row using the following commmands:
for row in f:
g=row
s=g[0]
end_of_first_name=s.find(",")
first_name=s[0:end_of_first_name]
I got the following error message:
Traceback (most recent call last):
File "", line 3, in module
s=g[0]
IndexError: list index out of range
Does anyone know why I would get this error message and how I can correct it?