I would like to convert stuff from my csv.reader to a dictionary. I implemented the instructions from this post Add new keys to a dictionary? but I keep getting IndexError: list index out of range
. How can I fix this?
import wx
import csv
info = csv.reader(open('report.csv', 'rb'),delimiter=',')
length = 0
info_list = []
for row in info: #search each row in the report
info_list.append([length,row[1],row[4]])
length = length + 1
print length
dict_info = {}
rows = 0
counter = 0
while counter < length:
for item in info_list:
dict_info[item[rows]] = [item[rows + 1], item[rows + 2]]
rows = rows + 3
counter = counter + 1
print dict_info