在python中,如何为threadpoolexecutor传递两个参数?
上面是我的示例代码格式。我想在_names()的列表_中使用ThreadPoolExecutor传递名称和键值以检查_和_execute() 我应该列一张钥匙和名字的清单并用地图来做吗?或者我可以使用partial和map组合将各自的值传递给其他函数吗在python中,如何为threadpoolexecutor传递两个参数?,python,Python,上面是我的示例代码格式。我想在_names()的列表_中使用ThreadPoolExecutor传递名称和键值以检查_和_execute() 我应该列一张钥匙和名字的清单并用地图来做吗?或者我可以使用partial和map组合将各自的值传递给其他函数吗 from concurrent.futures import ThreadPoolExecutor from functools import partial threads = ThreadPoolExecutor(max_workers=2
from concurrent.futures import ThreadPoolExecutor
from functools import partial
threads = ThreadPoolExecutor(max_workers=20)
def check_and_execute(name, key):
response = s.get(f"www.google.com?search={name}", verify=False)
data = response.get_json()["content"]
if data["host_name"] == key:
return data["host_name"]
def list_of_names(hub="abcdef"):
response = s.get(f"www.abcd.com?search={hub}", verify=False)
data = response.get_json()["content"]
for x in range(len(data)):
key = data["host_key"]
name = data["name_of_host"]