I want to create a dictionary using two lists as keys
regions = ['A','B','C','D']
subregions = ['north', 'south']
region_dict = dict.fromkeys(regions, dict.fromkeys(subregions))
this produces the dictionay I want correctly:
{'A': {'north': None, 'south': None},
'B': {'north': None, 'south': None},
'C': {'north': None, 'south': None},
'D': {'north': None, 'south': None}}
However, if I try to update one of elements in this dict, I see that other elements are also being updated
region_dict['A']['north']=1
>>> {'A': {'north': 1, 'south': None},
'B': {'north': 1, 'south': None},
'C': {'north': 1, 'south': None},
'D': {'north': 1, 'south': None}}
I am not sure what exactly I'm doing wrong here. How can I update just one of the values in this dictionary?