在网站中,由于存在大量的图片,需要进行处理;

每次在测试的时候,遍历文件夹文件很快,但是涉及到对文件处理时,就非常的慢,昨晚想起诺神提及的分批处理;
突然想到可以用list分块来处理:
print ('files num is :',len(reslist))
print ('切割为:{} 份'.format(int(len(reslist)/1000)))
start =time.time()
for output in group_elements(int(len(reslist)/1000),reslist):
del_list = (list(output))
with ThreadPoolExecutor(max_workers=5) as pool:
results = pool.map(check,del_list)
测试处理3W3的文件,只需要10分钟,比之前快了非常多。。。

22W文件+处理,耗时52分钟,5线程

唯一的缺陷是,对某些二维码的识别还不到位。。。。。(可忽略了)

![[python] AES-GCM加解密函数-微慑信息网-VulSee.com](https://vulsee.com/wp-content/uploads/2024/12/4a3de68ff9eca0a01bae73a7470170f3.png)


![[python]文本处理-微慑信息网-VulSee.com](https://vulsee.com/wp-content/uploads/2023/12/e036ea90943d8195df3aa3e2ad3db122.png)
![[python] 输出颜色 - colorama / termcolor [补充]-微慑信息网-VulSee.com](https://vulsee.com/wp-content/uploads/2023/10/3ce37224d46fae3bee75b135ba129c77.png)
![[vulsee.com] 使用openpyxl 读取xlsx中的网址链接-微慑信息网-VulSee.com](https://vulsee.com/wp-content/uploads/2023/06/92d3798abeb4baabf03ebcf81d50e73e.png)








![[八卦] 王婷婷—揭秘一个大三女生的性爱录像-微慑信息网-VulSee.com](http://free.86hy.com/crack/pic/1.jpg)
![[随笔]今天国际警察节-微慑信息网-VulSee.com](http://photo.sohu.com/20041017/Img222528326.jpg)

青云网
