07 for 循环 创建进程
import time from multiprocessing import Process def f1(): time.sleep(0.5) print('xxx') if __name__ == '__main__': p_list = [] #for循环创建子进程,并且完成主进程等待所有子进程执行结束,才继续执行 for i in range(10): p = Process(target=f1,) p.start() p_list.append(p) p.join() # for pp in p_list: # pp.join() print('主进程结束')