title: Calculate difference in keys contained in two Python dictionaries
body: <p>Suppose I have two Python dictionaries - <code>dictA</code> and <code>dictB</code>. I need to find out if there are any keys which are present in <code>dictB</code> but not in <code>dictA</code>. What is the fastest way to go about it?</p>
  
  <p>Should I convert the dictionary keys into a set and then go about?</p>
  
  <p>Interested in knowing your thoughts... </p>
  
  <hr>
  
  <p>Thanks for your responses.</p>
  
  <p>Apologies for not stating my question properly.
  My scenario is like this - I have a <code>dictA</code> which can be the same as <code>dictB</code> or may have some keys missing as compared to <code>dictB</code> or else the value of some keys might be different which has to be set to that of <code>dictA</code> key's value.</p>
  
  <p>Problem is the dictionary has no standard and can have values which can be dict of dict.</p>
  
  <p>Say</p>
  
  <pre><code>dictA={'key1':a, 'key2':b, 'key3':{'key11':cc, 'key12':dd}, 'key4':{'key111':{....}}}
  dictB={'key1':a, 'key2:':newb, 'key3':{'key11':cc, 'key12':newdd, 'key13':ee}.......
  </code></pre>
  
  <p>So 'key2' value has to be reset to the new value and 'key13' has to be added inside the dict.
  The key value does not have a fixed format. It can be a simple value or a dict or a dict of dict.</p>