I want to read back a line from a specific line/string in python
<p>this is the code that has me really confused:</p>

<pre><code>if search in open('test.txt').read():
    print("product is found")
</code></pre>

<p>i am trying to re-read a line fro my text file using the .read() function however i do not know how this would work from searching a single string. EG: if search is 12345 i want to find this in the text file and then output it on the shell. I have tried numerous different ways but cannot get it to work. This is for my work experience and would help me a lot.</p>

<p>try:</p>

<pre><code>s = input("enter")
file = open("test.txt","r")
for line in file:
    if s in open('test.txt').read():
        print("product is found")
</code></pre>

python