-3
页
存在,我想通过urllib2
每5 2连接到一个网站,并获得所有的HTML 在这之后,我想查一个词在页面或不如何连接到网页,并检查一个单词在
例如我想连接到google每5二,检查谷歌在网页或不
我试试这个代码:
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)
我使用Python 2.7
你甚至尝试阅读[urllib的文档(https://开头的文档。 python.org/2/library/urllib2.html)? – spectras
(作为旁注,您可能想要使用更高层次的抽象,比如优秀的[请求](http://docs.python-requests.org/en/master/)包) – spectras
是的,我读了'urllib'但是不理解它 – nonename