with ThreadPoolExecutor() as pool:
futures = {}
for url, html in htmls:
future = pool.submit(blog_spider.parse, html)
futures[future] = url
for future in as_completed(futures):
print(futures[future], future.result())
参考资料
https://blog.csdn.net/sixteen_16/article/details/116176587?spm=1001.2101.3001.6650.4&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-4-116176587-blog-103244542.pc_relevant_3mothn_strategy_recovery&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-4-116176587-blog-103244542.pc_relevant_3mothn_strategy_recovery&utm_relevant_index=5