startTime = time.time() threads = [] # 可以调节线程数, 进而控制抓取速度 threadNum = 4 for i in range(0, threadNum): t = threading.Thread(target=fetchUrl, args=(urlQueue,)) threads.append(t) for t in threads: t.start() for t in threads: #多线程多 join 的情况下,依次执行各线程的 join 方法, 这样可以确保主线程最后退出, 且各个线程间没有阻塞 t.join() endTime = time.time()