标签:线程 maker adp code 线程池 rom http from 大小
import threadpool import requests from hashlib import md5 urls = [ ‘http://www.178linux.com/wp-content/uploads/2018/02/5.jpg‘, ‘http://img1.imgtn.bdimg.com/it/u=1139158180,2224775217&fm=11&gp=0.jpg‘, ‘http://www.linuxidc.com/upload/2019_04/19041915053582.png‘, ‘http://www.veryxue.com/file/upload/201905/09/201804031578.jpg‘, ‘http://5b0988e595225.cdn.sohucs.com/images/20171209/8e81dcb041a9425c823daf6b6053e03b.jpg‘ ] def test(url): print(url) pool = threadpool.ThreadPool(200) # 最多启动200个线程,线程池的大小 reqs = threadpool.makeRequests(test, urls) # 第一个参数是执行哪个函数,第二个是所有的数据 [pool.putRequest(r) for r in reqs] # 和下面的是一样的 # for r in reqs: # pool.putRequest(r) pool.wait() print(‘over!!‘)
标签:线程 maker adp code 线程池 rom http from 大小
原文地址:https://www.cnblogs.com/skyxiuli/p/10959332.html