『Python』多进程

时间:2021-06-04 19:54:54   收藏:0   阅读:0

https://docs.python.org/3/library/multiprocessing.html?highlight=imap_unordered#multiprocessing.pool.Pool.imap_unordered

注意,worker函数不能写在其他函数内部:

def fun1():

    def worker():

        pass

多个参数时直接用[(),()]传实际会将()传给worker的首个参数,所以worker接收argv,在worker内用0~n去索引()的元素就行了

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!