每隔固定时间抓取百度 python代码,抓取python,<每隔固定时间抓取百度


<每隔固定时间抓取百度 python代码>

每隔固定时间抓取百度 python代码代码片段

1.[代码][Python]代码

#coding: utf-8# www.iplaypy.com pythonimport sysimport urllibimport urllib2from BeautifulSoup import BeautifulSoupfrom time import sleepwhile(True):    try:        res = urllib2.urlopen("http://www.baidu.com/")        #baidu is encoded by gbk        print res.read()        sleep(3600) #per hour    except(KeyboardInterrupt):        print("\nbyebyebye.~")        break"""

编橙之家文章,

评论关闭