Break multiple lines in a text file into a list of lists
<p>I am working with a text file ex:</p>

<pre><code>blahblahblahblahblahblahblah
blahblahblahblahblahblahblah
start
important1a important1b
important2a important2b
end
blahblahblahblahblahblahblah
</code></pre>

<p>What I want is to get an output like</p>

<pre><code>["'important1a', 'important1b'", "'important2a', 'important2b'"]
</code></pre>

<p>Where each important line is split into individual elements, but they are grouped together by line in one list.</p>

<p>I have gotten close with this:</p>

<pre><code>import shlex

useful = []
with open('test.txt', 'r') as myfile:
    for line in myfile:
        if "start" in line:
            break
    for line in myfile:
        if "end" in line:
            break       
        useful.append(line)

data = "".join(useful)

split_data = shlex.split(data)
print split_data
</code></pre>

<p>This outputs:</p>

<pre><code>['important1a', 'important1b', 'important2a', 'important2b']
</code></pre>

<p>There is no distinction between lines.</p>

<p>How can I modify this to distinguish each line? Thanks!</p>
