I have a small problem with creating my code. I am trying to merge two dictionaries in Python. Each of them has set of keys lets say:
a={person_id:xx, address_id: xx, name:xx}
b={address_id:xx, street:xx, postcode:xx, town:xx}
Each of them has many entries and by that I mean they look like:
a={person_id:1. address_id:20, name:john; person_id:2, address_id:200,
name: mary';... and 10000 more entries like that}
b={address_id:20... same situation like in a}
I would like to get:
merged_dic={person_id:xx, address_id {street:xx, postcode:xx, town:xx}, name:xx; person_id:xxx.. and so on}
I tried so many different things, update, defaultdict and many more and none of them worked. I don't want to overwrite things, I just want to create some sort of nested dict.
Any ideas on how to proceed?
adict has duplicate keys and one can't c'n'p this code.