Python:具有多个参数的 pool.map_async

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

我需要一些关于 python 池的帮助。

def read_values(entry, second):
 ....

async_output = pool.map_async(partial(read_values, second='second'), string_array)
output_array = async_output.get()

上面的代码正在运行。我真的想要以下内容:

logfile = open("./async.log", "a+", 1)

def read_values(entry, second):
 ....

async_output = pool.map_async(partial(read_values, second=logfile), string_array)
output_array = async_output.get()

这不起作用!

是否可以将打开的文件引用传递给池?

python pool filereference
© www.soinside.com 2019 - 2024. All rights reserved.