I am trying to write a python code where I can employ python multiprocessing. The actual code is long and complicated so I will try to explain my problem using a simple scenario:
consider the following function:
def Parfunc(x):
print ('abcd')
return x*x*random.random()
When I employ this function with a for loop it not only return the value but also does the print 'abcd'. Now when I do the same using the following code, it does return the values but the print function doesn't seem to work:
from multiprocessing import Pool
if __name__ == '__main__':
pool = Pool(processes=4)
print(pool.map(Parfunc, range(1,21)))
any help would be appreciated...