[D]python运行多线程出现错误
IDLE's subprocess didn't make connection.Either IDLE can;t start a subprocess or personal firewall software is blocking the connection
我就是按照书上写一个多线程的小程序,代码如下
import threadingimport timeclass ThreadDemo(threading.Thread): def __init__(self,index,create_time): threading.Thread.__init__(self) self.index=index self.create_time=create_time def run(self): time.sleep(1) print((time.time()-self.create_time),"\t",self.index) print("Thread %d exit"% (self.index))for index in range(5): thread=ThreadDemo(index,time.time()) thread.start()print("Main Thread exit...")