# -*- coding:utf-8 -*- # 继承式调用 import threading import time class MyThread(threading.Thread): def __init__(self, num): super(MyThread,self).__init__() #threading.Thread.__init__(self) self.num = num def run(self): # 定义每个线程要运行的函数(必须是run) print("running on number:%s" % self.num) time.sleep(3) print("done") t1 = MyThread(1) t2 = MyThread(2) t1.start() t2.start()