from multiprocessing import Process
import time
def f(name):
time.sleep(1)
print('hello',name,time.ctime())
if __name__ == '__main__':
p_list=[]
for i in range(3):
p = Process(target=f,args=('xi',))#创建三个子进程
# 执行函数f 参数alvin
p_list.append(p)#方便下面一起join
p.start()
for p in p_list:
p.join()
print('end')
虽然也是菜鸟,但是感觉缩进怪怪的?