I have been struggling for a while to make this work and maybe i'm missing something here.
The purpose of the followin code is to add the values found on the column 1 of each row of a CSV to the dictionary contining a list in the second(1) position, so that the new value is appended to the list and not overriden every time the same key is found on the CSV(because the same key appears repated severals times).
csr = {}
with open('RawPolicy.csv', newline='') as rulemaker:
rmatcher = csv.reader(rulemaker, delimiter=" ")
for row in rmatcher:
lst = []
csr[row[6]]=[row[0],lst.append(row[1]),row[2],row[3],row[4],row[5]]
But i always get the following error and it makes no sense for me because the indentation seems ok for me.
when i remove the list(lst) from inside of the for loop and the "lst.append(row[1])" part the script works but doesnt do what i want.
csr[row[6]]=[row[0],lista.append(row[1]),row[2],row[3],row[4],row[5]]
TabError: inconsistent use of tabs and spaces in indentation