How to print a file line by line in specific interval continuously using python?
<p>I have a file with 4 website names as shown below. I want to print each website name one by one continuously, in specific interval.</p>

<p>sample.txt:</p>

<pre><code>facebook.com
gmail.com
test.com
yahoo.com
</code></pre>

<p>I have tried with following code. But its print website names only once. I wanted to website names continuously.</p>

<pre><code>from time import sleep

while True:
    with open ("sample.txt", 'r') as test:
        while True:
            print test.readline()
            sleep(3)
    pass
</code></pre>

<p>Expected output:</p>

<pre><code>facebook.com
gmail.com
test.com
yahoo.com
facebook.com
gmail.com
test.com
yahoo.com
facebook.com
gmail.com
test.com
yahoo.com
facebook.com
gmail.com
test.com
yahoo.com
.
.
.   
</code></pre>

<p>Can I get help to fix this issue?</p>

<p>Thanks.     </p>