how to connect to page and check a word exist in page
<p>i want connect to a site by <code>urllib2</code> in every 5 second and get all html 
after this i want check a word is in page or not </p>

<p>for example i want connect to <a href="http://google.com" rel="nofollow">google</a> every 5 second and check google is in page or not</p>

<p>i try this code :</p>

<pre><code>import urllib2
import time

while true:
    values = urllib2("http://google.com")
    if "google" in values:
        print("google is in my address")
    else:
        print("google not in my address")
    time.sleep(5)
</code></pre>

<p>i use python 2.7 </p>

<p>your code have error </p>

<p>change your code to this :</p>

<pre><code>import urllib2
import time

while true:
    values = urllib2.urlopen("http://google.com").read()
    if "google" in values:
        print("google is in my address")
    else:
        print("google not in my address")
    time.sleep(5)
</code></pre>

<p>this code every 5 second check your site</p>

python