前言 很多地方都要用到多线程,这是我经常用的多线程代码,放在博客园记录下. 代码 from multiprocessing.pool import ThreadPool thread = 10 item_list = [1,3,4,5,6,7,8,9,10] def sub(item): #do somthing... print(item) if __name__ == '__main__': pool = ThreadPool(processes = thread) pool.map(sub…