Skip to content
UPEEC

concurrent.futures

A simple, uniform API for thread and process pools.

Intermediate
Comments 0
from concurrent.futures import ThreadPoolExecutor, as_completed
with ThreadPoolExecutor() as ex:
    futures = [ex.submit(fetch, u) for u in urls]
    for f in as_completed(futures): print(f.result())

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.