很简单的多线程访问python嘿嘿嘿

import urllib
import socket
from threading import * url = "http://www.baidu.com/s?ie=UTF-8&wd=tofind.space"
cishu = 0
socket.setdefaulttimeout(15) def gethtml():
global cishu
cishu += 1
print cishu
urllib.urlopen(url).read() def attack():
while True:
try:
gethtml()
except error:
pass def run():
t = Thread(target=attack)
t.start() for i in range(10):
run()
上一篇:关于这次安装Oracle


下一篇:用于构建 RESTful Web 服务的多层架构