Python: item for item until stopterm in item?
<p>Disclaimer: I'm fairly new to python!</p>

<p>If I want all the lines of a file until (edit: and including) the line containing some string <code>stopterm</code>, is there a way of using the list syntax for it? I was hoping there would be something like:</p>

<pre><code>usefullines = [line for line in file until stopterm in line]
</code></pre>

<p>For now, I've got</p>

<pre><code>usefullines = []
for line in file:
    usefullines.append(line)
    if stopterm in line:
        break
</code></pre>

<p>It's not the end of the world, but since there rest of Python syntax is so straightforward, I was hoping for a 1 thought->1 Python line mapping.</p>
