本文共 607 字,大约阅读时间需要 2 分钟。
get url response time
-
-
-
-
-
-
-
-
- import time,urllib2, sys, re
-
-
- URL = 'http://www.baidu.com’
-
- ''
-
-
- s=urllib2.urlopen(URL).read()
- ss=s.replace(" ", "")
- urls=re.findall('"[a-z]+://[a-zA-Z0-9]+.*?"', ss, re.I)
-
- ''
-
-
- for i in urls:
- START_TIME = time.time()
- url = i.replace('"', '')
- try:
- urllib2.urlopen(url)
- END_TIME = time.time()
- TIME = END_TIME - START_TIME
- print i,TIME
- except:
- print i,"url error"
纯属个人记录,不做过多说明
转载地址:http://bftto.baihongyu.com/