I am trying to store the 2nd 1 delimited spot in a csv UTF-8 file. My logic seems right but I KEEP GETTING an index out of range error which I can't seem to extrapolate. Here is my code: mylist_n = [] with open(r'/home/main/Documents/AMCO/mypythonAMCO/ralco_Info.csv') as csvfile: spamreader = csv.reader(csvfile,delimiter=',', quotechar='|') reader = csv.reader(csvfile)
for row in spamreader:
print(', '.join(row))
mylist_n.append(row[1])
'''
IndexError Traceback (most recent call last)
<ipython-input-46-5b4beea38798> in <module>
6
7 print(', '.join(row))
----> 8 print(row[3]) #read the make -- write to list
IndexError: list index out of range
I know it has something to do with the output of row and a particular module/function call. That's all I need. I plan on getting position 3, storing it in a list and other respective positions related to make/model and eventually making a dictionary of dates with respective values to make the otherwise extraordinarily long name condensed.
0, therefore3means the 4th item. - Michael Butscher