On this page
article
Thread Pool for I/O
Run blocking I/O concurrently.
Category: concurrent.futures
Problem
Run blocking I/O concurrently.
Solution
with ThreadPoolExecutor(10) as ex:
list(ex.map(fetch, urls))
Notes
- Adapt variable names and paths to your project
- Add error handling for production use
- See related chapters in the Learning Path