reading lines of a file between two words
<p>I have a file containing numbers and 2 words : "start" and "middle"
I want to read numbers from "start" to "middle" in one array and numbers from "middle" to end of the file into another array.
this is my python code:</p>

<pre><code>with open("../MyList","r") as f:
        for x in f.readlines():
            if x == "start\n":
                continue
            if x == "middle\n":
                break
            x = x.split("\n")[0]
            list_1.append(int(x)) 

        print list_1

        for x in f.readlines():
            if x == "middle\n":
                continue
            list_2.append(int(x))

        print list_2
</code></pre>

<p>but the problem is that my program never enters second loop and jumps to</p>

<pre><code>print list_2
</code></pre>

<p>I searched in older questions but can not figure out the problem.</p>