title: How to filter a dictionary in Python?
body: <pre><code>d = {'foo': 'x',
       'bar': 'y',
       'zoo': 'None',
       'foobar': 'None'}
  </code></pre>
  
  <p>I want to filter all the items whose value is <code>'None'</code> and update the <code>foo</code> and <code>bar</code> items with a particular value. I tried:</p>
  
  <pre><code>for i in x.items():
     ....:    if i[i] == 'None':
     ....:        x.pop(i[0])
     ....:    else:
     ....:        x.update({i[0]:'updated'}) 
  </code></pre>
  
  <p>But it is not working.</p>