标签:方法 join() def pre process append __name__ ESS class
#方法一 直接调用
import time
import random
from multiprocessing import Process
def run(name):
index = 0
for i in range(3):
print('%s runing' %name)
time.sleep(random.randrange(1,5))
print('%s running end' %name)
index +1
l = []
if __name__ == "__main__":
for i in range(20):
p = Process(target=run,args=(i,))
p.start()
l.append(p)
for proc in l:
proc.join()
print("执行完毕")
标签:方法 join() def pre process append __name__ ESS class
原文地址:https://www.cnblogs.com/asia9847/p/11951783.html