如何通过 multiprocessing.dummy 池代替列表、字典来实现并发(异步)
How to put instead of a list, a dictionary, for concurrency (asynchrony) through the multiprocessing.dummy Pool
我想 运行 文件的飞跃,但为此我需要一本字典,因为它更容易计时,让我们这样说:{'first_name': ['first_link', 'second_link']}
事实证明 Pool 只需要第一个 key
,即字符串 ,结果 the values are not available
并发生错误,我怎样才能将字典而不是链接列表发送到那里?
P.S。我可以向池发送多个参数吗?
results = pool.map (download_file, cat_l_dict, some _dict)
将你的词典添加到列表中
results = pool.map(download_file, [cat_l_dict])
在那之后 dict 会像 dict 一样工作
我想 运行 文件的飞跃,但为此我需要一本字典,因为它更容易计时,让我们这样说:{'first_name': ['first_link', 'second_link']}
事实证明 Pool 只需要第一个 key
,即字符串 ,结果 the values are not available
并发生错误,我怎样才能将字典而不是链接列表发送到那里?
P.S。我可以向池发送多个参数吗?
results = pool.map (download_file, cat_l_dict, some _dict)
将你的词典添加到列表中
results = pool.map(download_file, [cat_l_dict])
在那之后 dict 会像 dict 一样工作