import threading
import time
class Mythread(threading.Thread):
def __init__(self,n):
super(Mythread,self).__init__()
self.n=n
def run(self):
print("task",self.n)
time.sleep(2)
t1=Mythread("t1")
t2=Mythread("t2")
t1.run()
t2.run()
用类的方法实现thread
最新推荐文章于 2021-11-13 16:24:53 发布