import time
def func(name,n):
print(f'{name} start')
time.sleep(n)
print(f'{name} end')
t1 =Thread(target=func,args=('线程1',1))
t2 =Thread(target=func,args=('线程2',2))
t3 =Thread(target=func,args=('线程3',3 ))
start = time.time()
print('start:', start)
t1.start()
t2.start()
t3.start()
t1.join() # 等待子线程运行结束
t2.join()
t3.join()
end = time.time()
print('end:', end)
print(end-start)
"""
start: 1600005403.932771
线程1 start
线程2 start
线程3 start
线程1 end
线程2 end
线程3 end
end: 1600005406.9414575
3.0086865425109863
"""