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
猜你喜欢
转载自blog.csdn.net/manqianfu9364/article/details/79449487
今日推荐
周排行