https://segmentfault.com/a/1190000000414339    一行 Python 实现并行化

 

注:

--为 CPU 密集型任务和 IO 密集型任务分别选择多进程和多线程库来进一步提高执行速度——这也是解决死锁问题的良方

from multiprocessing.dummy import Pool as ThreadPool    #多线程
from multiprocessing import Pool  #多进程

#pool = ThreadPool ()
pool = Pool()
pool.map(func,args)

 

posted on 2018-02-12 09:49  妞溜溜  阅读(125)  评论(0)    收藏  举报