【发布时间】:2014-08-01 08:17:20
【问题描述】:
我有一个类似下面的函数,它需要一个列表和一个路径:
def my_function(items_list,directory):
return(resulting number of analyzing items_list for example [a,b] using specific file for example 'c:\\path')
做并行计算,我使用多处理模块如下:
from multiprocessing import Pool
def test_func(objs):
pool= Pool(8)
result=pool.map(my_function,objs)
return(result)
if __name__=='__main__':
objects=[([a,b],'path1',),([c,d],'path2',),.....]
result=test_funct(objects)
但它给了我以下错误: TypeError: my_function() 缺少 1 个必需的位置参数:'directory'
我多次更改对象列表格式,但它一直给我同样的错误。 有人知道问题是什么吗? (我在 Windows 7 上使用 python33)
【问题讨论】:
标签: python python-3.x multiprocessing