Why the loop to search for a string that is present in a file returns True for first iteration and False for the rest? : <p>I have a file named text.txt which contains the following data:</p>

<pre><code>My
Name
Is
Lorem
Ipsum
</code></pre>

<p>My python code:</p>

<pre><code>with open("text.txt") as f:
    for i in xrange(5):
        print "Is\n" in f
</code></pre>

<p>Output:</p>

<pre><code>True
False
False
False
False
</code></pre>

<p>Why the output is True only when i=0?</p>

<p>What to do to get True for all the iterations? I do not want to store the contents of the file anywhere!</p>
