How does this line work in this python script
<pre><code>food = dict(line.split(":", 1) for line in open("file") if line.strip())
</code></pre>

<p>I know what this code does but I don't understand why it was put together like this, So can someone explain to me the logic of adding the "if" statement at the end.</p>

<p>How does telling the script to make a dictionary using iteration from a file work, then just adding </p>

<pre><code>if line.strip() 
</code></pre>

<p>work? doesn't something need to go after that statement?? What is it telling the script since there is no condition after it?</p>

<p>I know this code works because I tried it but I'm baffled at HOW it works.</p>
