class Mythreading(threading.Thread): def __init__(self,num): threading.Thread.__init__(self) self.num = num def run(self): print("这是线程哦",self.num) time.sleep(2) t1 = Mythreading(1) t2 = Mythreading(2) t1.start() t2.start()
class Mythreading(threading.Thread): def __init__(self,num): threading.Thread.__init__(self) self.num = num def run(self): print("这是线程哦",self.num) time.sleep(2) t1 = Mythreading(1) t2 = Mythreading(2) t1.start() t2.start()