I'm trying to read in a csv into a 2D array, and I seem to be stuck. Any help with the below code will be appreciated.
import sys, csv
rowColumn = []
rowColumn.append([])
rowColumn.append([])
with open('filelocation.csv', "r+") as inputFile:
fieldnames = ['col1','col2','col3','col4','col5','col6','col7','col8',]
reader = csv.reader(inputFile)
i1=-1
i2=0
for row in reader:
i1=i1+1
print(row)
for item in row:
#store item in 2D list/array
rowColumn[i1][i2].append(item)#error occurs here
i2=i1+1