def single_thread():print('single_thead begin')for url in blog_spider.urls:blog_spider.craw(url)print("single_thread end")def multi_thread():print('multi_thread begin')threads = []for url in blog_spider.urls:threads.append(thread.Thread(blog_spider,args=(url,)))for thread in threads:thread.start()for thrad in threads:thread.join()print("multi_thread end")
