join方法
import time from multiprocessing import Process def f1(): time.sleep(2) print('xxxx') def f2(): time.sleep(2) print('ssss') # f1() # f2() if __name__ == '__main__': p1 = Process(target=f1,) p1.start() p1.join() # 主进程等待子进程运行完才继续执行 print('开始p2拉') p2 = Process(target=f2,) p2.start() p2.join() print('我要等了...等我的子进程...') # time.sleep(3) print('我是主进程!!!')