I am trying to update values in a nested dictionary, without over-writting previous entries when the key already exists. For example, I have a dictionary:
myDict["myKey"]["nestedDictKey2"] = anotherValue
myDict["myKey"] returns the nested dictionary to which we can add another key like we do for any dictionary :)
myDict["myKey"]
Example:
>>> d = {'myKey' : {'k1' : 'v1'}} >>> d['myKey']['k2'] = 'v2' >>> d {'myKey': {'k2': 'v2', 'k1': 'v1'}}