20 lines
530 B
Python

from concurrent.futures import ThreadPoolExecutor, as_completed, wait
import SD_scrawl
# ==========多线程处理==========
def Threads(Links):
executor = ThreadPoolExecutor(max_workers=25) # 进程池
# 进行多线程处理
futures = [executor.submit(SD_scrawl.Scrawl, Link) for Link in Links]
# 等待所有进程完成
for future in as_completed(futures):
try:
future.result()
except Exception as e:
print("An error occurred:", str(e))
wait(futures)