多线程中ThreadPoolExecutor.map()中传递多个参数

多线程中ThreadPoolExecutor.map()中传递多个参数_第1张图片

    with concurrent.futures.ThreadPoolExecutor(max_threads) as executor:
        results = executor.map(get_captcha_image, ip_addrs, [img_url] * len(ip_addrs)) #要传入多个参数时,每个参数都得是固定相同长度的可迭代对象

    # 收集结果
    for result in results:
        print(result)
        if result != None and len(result) > 10000:
            print("最后"+str(result))
            return result
        #return '1212'

你可能感兴趣的:(python)