with concurrent.futures.ThreadPoolExecutor(maxworkers=100) as executor: print(f"Solving…
- User
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor: print(f"Solving {len(proxies)} captchas") results = executor.map(complete_captcha, proxies)
I want to call the complete_captcha function, and then return a list of captchas. how do i do that?
- Assistant
To return a list of results from the
complete_captchafunction that you invoke usingThreadPoolExecutor, you can simply convert the results from theexecutor.mapcall into a list. Theexecutor.mapfunction returns an iterator that yields results as they become available, but you can uselist()to immediately gather all of them into a list. Here's how you can modify your code:python