from multiprocessing import Pool
pool = Pool()
data = pool.starmap(func, tasks) # 运行多参数函数
# data = pool.map(func, tasks) # 运行单参数函数
pool.close()
pool.join()
''' 多线程运行多参数函数的任务组建 '''
x = [1,2,3]
y = [4,5,6]
z = [7,8,9]
tasks = list(zip(x, y ,z))
from multiprocessing import Pool
pool = Pool()
data = pool.starmap(func, tasks) # 运行多参数函数
# data = pool.map(func, tasks) # 运行单参数函数
pool.close()
pool.join()
''' 多线程运行多参数函数的任务组建 '''
x = [1,2,3]
y = [4,5,6]
z = [7,8,9]
tasks = list(zip(x, y ,z))