python池映射多个参数-列表和变量作为输入

问题描述 投票:0回答:1

我想对一个函数进行多处理(见下文)

def func(c):
    time =  time
    list = [c, time]
    another_func(list)

我按如下方式运行上述功能:

p = multiprocess.Pool()
p.map(func, cust, chunksize=1)
p.close()
p.join()

cust是类似字符串的列表

cust = ['c1', 'c2', ...]

现在我的问题是可以将时间变量放入p.map之类吗?>

p.map(func, cust, time, chunksize=1) 

我在这里搜索了多个主题,但没有找到匹配的主题。

非常感谢您的帮助/提示!

我想对一个函数进行多处理(见下文)def func(c):time =时间列表= [c,时间] another_func(list)我按以下方式运行上述函数:p = multiprocess.Pool()p。 map(...

python dictionary multiprocessing arguments pool
1个回答
0
投票

您可以使用starmap

© www.soinside.com 2019 - 2024. All rights reserved.