title: How to update the nested dictionary in Python?
body: <p>I have a dictionary called <code>old_dict</code>, this has a template of entire required fields. I want it to get updated with the selective fields I have received. Why is that dictionary <code>update</code> method doesn't work here? Next, what is the correct way to update this?
  Do I need to loop around and check for each key and value and then check whether value is
  itself has a key and value. If so then keep iterating. What is the way to do so?
  I am looking for simplicity rather than a recursion solution.</p>
  <p>Here is my current code:</p>
  <pre><code>old_dict = {'account': {'user': None, 'displayName': None, 'domain': '', 'dnsSrv': False, 'proxies': [{'addr': None, 'port': 5060}], 'vendor': 2, 'auth': {'user': None, 'passwd': None}, 'transport': 2, 'regInterval': 3600, 'avpfInterval': 3, 'sipsUri': False, 'avpf': False, 'reqRegister': True, 'pubPresenceInfo': False}}
  print(old_dict)
  
  new_dict = {'account': {'user': '007', 'dnsSrv': True, 'proxies': [{'addr': '10.10.10.201'}], 'pubPresenceInfo': False}}
  print(new_dict)
  
  old_dict.update(new_dict)
  print(&quot;updated data&quot;)
  print(old_dict)
  </code></pre>
  <p>I can see that displayName, domain and other fields are gone now. It has simply replaced account key with updated account key.
  How to tell Python to update individual items there?</p>