'''多线程-继承方式'''import threadingimport timeclass Hello(threading.Thread): def __init__(self,args): super(Hello,self).__init__() self.args = args #必须重写run方法 def run(self): print("开始子进程{0}".format(self.args)) time.sleep(1) print("结束子进程{0}".format(self.args))if __name__ == '__main__': print("start main") t1 = Hello(1) t2 = Hello(2) t1.start() t2.start() print("end main")