multiprocess passing arguments double asterisks

pic8690 at gmail.com pic8690 at gmail.com
Sun Oct 23 03:10:35 EDT 2016


import <span class="highlight" style="padding-left: 0px; padding-right: 0px;">multiprocess</span>ing as mp
 
def bar(**kwargs):
   for a in kwargs:
      print a,kwargs[a]
 
arguments={'name':'Joe','age':20}
p=mp.Pool(processes=4)
p.map(bar,**arguments)
p.close()
p.join()



Errors:

Traceback (most recent call last):
  File "post.py", line 9, in <module>
    p.map(bar,**arguments)
TypeError: map() got an unexpected keyword argument 'age'

How do I pass the dictionary arguments?



More information about the Python-list mailing list