>>> default_dd={'A':1,'B':2,'C':3,'D':4,'E':5}
>>> dd={'B':2000,'D':4000}
>>> for key in default_dd.keys():
... if not key in dd.keys():
... dd[key]=default_dd[key]
...
>>> dd
{'A': 1, 'C': 3, 'B': 2000, 'E': 5, 'D': 4000}
Mostly Linux & Python syntax notes and hyperlinks.
No comments:
Post a Comment