I want to create a dict that can be accessed:
d[id_1][id_2][id_3] = amount
At the moment, I have a huge ugly function:
def parse_dict(id1,id2,id3,principal, data_dict):
if data_dict.has_key(id1):
values = data_dict[id1]
if values.has_key[id2]
..
else:
inner_inner_dict = {}
What is the pythonic way to do this?
Notice that I introduce the principal .. but what I want is the sum .. So, if all three keys are there .. add the principal to the previous sum!
thank
source
share