from selenium import webdriver import threading def test_search(url): driver = webdriver.Chrome() driver.get(url) #time.sleep(5) #driver.quit() data={} threads = [] for i in range(157,167): if i<10: temp='00'+str(i) elif i<100: temp='0'+str(i) else: temp=str(i) url='https://***/d56cf000{}.ts'.format(temp) data[i]=url #print(data) for url in data.items(): #多线程 t1 = threading.Thread(target=test_search, args=(url[1],)) threads.append(t1) # 启动 for t2 in threads: t2.start() #t2.join()#此处注释掉会同时运行。但同时运行可能会出现遮挡导致有问题哦。