String Index Out Of Range When Reading Text File
<p>I keep on getting this error on the second last line of my program , and I am not sure why , all I am doing is reading a line from a text file.</p>

<pre><code>if (items[0]) == 86947367 :
        with open("read_it.txt") as text_file:
            try:
                price = int(text_file.readlines()[2])
            except ValueError:
                print("error")
            else:
                new_price = int(price * (items2[0]))
                print("Â£",new_price)
                price_list.append(new_price)
                product = (text_file.readline()[1])
                print(product)
</code></pre>

<p><strong>problem:</strong></p>

<pre><code>price = int(text_file.readlines()[2])
</code></pre>

<p>the readlines() cause the readline() to return none or something like that.
try to store readlines() in a 
<strong>tmp var and then</strong> </p>

<pre><code>price = tmp[2]
product =tmp[1]
</code></pre>

python python-3.x