python实现子线程代码“同时”执行完毕后,再执行某个代码(主进程)。
希望对大家有所帮助。
from threading import Thread
from multiprocessing import Process##
import time
class MyThread(Thread):
def init (self):
super(). init ()
def run(self):
time.sleep(1)
print("%s正线程正在下载。。。"%self.name)
# print(self.sth)
# return self.sth
def runThread():
for i in range(20):
newThread = MyThread()
newThread.start()
# newThread.join()
p = Process(target=runThread)
p.start()
p.join()
print(‘end’)`
版权声明:本文为zc20050614原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。