removing dict entries by key using startswith
<p>I have a dict containing several entries beginning with '_'.
I want to get rid of all this entries using:</p>

<pre><code>for key in item:
    if key.startswith('_')
        del item[key]
</code></pre>

<p>But i get a syntax error on  <em>if key.startswith('_')</em></p>

<p>Is this method not allowed on key for dicts?</p>

<p>You miss the <code>:</code> at the end of the if.</p>

<pre><code>for key in item:
    if key.startswith('_'): # &lt;----------
        del item[key]
</code></pre>

python