python爬虫超时的处理的实例
时间:2021-02-04 11:37:21|栏目:Python代码|点击: 次
如下所示:
#coding:utf-8 ''''' Created on 2014-7-24 @author: Administrator ''' import urllib2 try: url = "http://www.baidu.com" f = urllib2.urlopen(url, timeout=0) #timeout设置超时的时间 result = f.read() # print len(result) print result except Exception,e: print 'a',str(e)
上一篇:python求素数示例分享
栏 目:Python代码
本文标题:python爬虫超时的处理的实例
本文地址:http://www.codeinn.net/misctech/57068.html






