title: Python dictionary keys changed during iteration
body: <p>I have a dict like this:</p>
  <pre><code>     d={
           'McAfee': {'DatDate': '123','DatVersion': '456'},
           'AntiVirus': {'AVName': ['Mac Defender', 'Windows Defender'],'AVVersion': ['262144', '393472']}
         }
  </code></pre>
  <p>Now I want to change the key of d and change the value's key of d too according to this mapping:</p>
  <pre><code>mapping_table = {&quot;McAfee&quot;:'Mc_table','AntiVirus':'An_table'}
  
  mapping_coulmn = {'DatDate':&quot;Dc_column&quot;,'AVName':'Av_column','DatVersion':'Da_column','AVVersion':'AVV_column'}
  </code></pre>
  <p>The output should like:</p>
  <pre><code> d={
      'Mc_table': {'Dc_column': '123','Da_column': '456'},
      'An_table': {'Av_column': ['Mac Defender', 'Windows Defender'],'AVV_column': ['262144', '393472']}
      }
  </code></pre>
  <p>What I tired is:</p>
  <pre><code>for key in d:
      if key in mapping_table:
          new_key = mapping_table[key]
          d1[new_key]=d.pop(key)
          
  print(d)
  </code></pre>
  <p>It returns an error:</p>
  <pre><code>RuntimeError: dictionary keys changed during iteration
  </code></pre>
  <p>Any friend can help?Thank you so much!</p>