def gg():
print(time.time())
return time.time()
t1=threading.Thread(target=
gg,)
t2=threading.Thread(target=
gg,)
t2=
threading.Thread()
t1.start()
t2.start()
View Code
import time,threading
class Mythread(threading.Thread):
def __init__(self,num):
threading.Thread.__init__(self)
self.num=
num
def run(self):
print(
'running number %s'%
self.num)
print(time.asctime())
time.sleep(3
)
if __name__==
'__main__':
t1= Mythread(1
)
t2= Mythread(2
)
t1.start()
t2.start()
View Code
转载于:https://www.cnblogs.com/ezway/p/6805380.html