python 多进程的参数问题。poll.map放一个参数是没有问题的,但是多个参数的时候报错,应怎么解决的?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 多进程的参数问题。poll.map放一个参数是没有问题的,但是多个参数的时候报错,应怎么解决的?相关的知识,希望对你有一定的参考价值。
map多进程的问题 map() takes from 3 to 4 positional arguments but 6 were given
map的问题 map() takes from 3 to 4 positional arguments but 6 were given
from multiprocessing import Pool , Lock ,Manager
poll=Pool()
def save(detail_url,g_count,b_count,d_count):
return detail_url*3+g_count+b_count+d_count
detail_url=[1]
g_count=[0]
b_count=[2]
d_count=[0]
poll.map(save, detail_url,g_count,b_count,d_count)
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 /Users/abc/PycharmProjects/ganji/test.py
Traceback (most recent call last):
File "/Users/abc/PycharmProjects/ganji/test.py", line 9, in <module>
poll.map(save, detail_url,g_count,b_count,d_count)
TypeError: map() takes from 3 to 4 positional arguments but 6 were given
Process finished with exit code 1
以上是关于python 多进程的参数问题。poll.map放一个参数是没有问题的,但是多个参数的时候报错,应怎么解决的?的主要内容,如果未能解决你的问题,请参考以下文章