很简单的多线程访问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()
原文地址:https://www.cnblogs.com/learn-to-rock/p/5450504.html