2006年03月21日 星期二 11:33
limodou,您好!
应该没问题啊,后面还有加上这些代码啊:
response_ob = conn.getresponse()
if response_ob.reason == 'OK':
self.stc.svc_stat = 'OK'
time_begin = time.time()
page_len = len(response_ob.read())
time_end = time.time()
time_cost = time_cost + round(time_end - time_begin, 4)
break
else:
======= 2006-03-21 11:26:17 您在来信中写道:=======
>On 3/21/06, charles huang <hyy at fjii.com> wrote:
>> python-chinese,您好!
>> 写了一段代码,来get一个页面,并计算所耗的时间,可发现每次读取页面所耗的时间都只有零点几秒,有的甚至只有零点零几秒,都怀疑是不是有cache,可httplib的文档里面好像没有提到这点,代码如下:
>>
>> conn = httplib.HTTPConnection('www.some-domain-name.com')
>> for j in xrange(3):
>> try:
>> time_begin = time.time()
>> conn.request("GET",'/index.htm')
>> time_end = time.time()
>> time_cost = round(time_end - time_begin, 4)
>> except:
>> time.sleep(2)
>> continue
>>
>>
>
>建议你看一下得到的内容,是不是出错了。
>
>--
>I like python!
>My Blog: http://www.donews.net/limodou
>NewEdit Maillist: http://groups.google.com/group/NewEdit
>_______________________________________________
>python-chinese
>Post: send python-chinese at lists.python.cn
>Subscribe: send subscribe to python-chinese-request at lists.python.cn
>Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn
>Detail Info: http://python.cn/mailman/listinfo/python-chinese
= = = = = = = = = = = = = = = = = = = =
致
礼!
charles huang
hyy at fjii.com
TEL: 0591-3333169-212
2006-03-21
Zeuux © 2025
京ICP备05028076号