concurrent.futures是一个Python自带的一个模块,可以方便地将程序转换为多进程、多线程运行。
对于需要花费大量的时间进行IO的程序,能够明显提升运行效率。

多进程——分别以0~720为参数,执行func函数
建立CPU核心数个进程来执行
将ProcessPollExecutor换成ThreadPoolExecutor则为多线程

import concurrent.futures

pool = concurrent.futures.ProcessPoolExecutor()
pool.map(func, range(0,720))

对于执行下载任务的爬虫项目,能极大加快爬取速度