I am trying to add another value to a nested dictionary by key, I have the below code but it doesn't work properly
Content is a file with:
a,b,c,d
a,b,c,d
a,b,c,d
dict = {}
for line in content:
values = line.split(",")
a = str.strip(values[0])
b = str.strip(values[1])
c = str.strip(values[2])
d = str.strip(values[3])
if a not in dict:
dict.update({a: {'Value1': b, 'Value2': c, 'Value3': d}},)
else:
dict[a]['Value1'].update(b)
I want it to look like:
a {'Value1': 'b,b,b', 'Value2': 'c', 'Value3': 'd'}
What am I doing wrong?