In the example code below, I'd like to get the return value of the function worker
. How can I go about doing this? Where is this value stored?
Example Code:
import multiprocessingdef worker(procnum):'''worker function''' print str(procnum) +' represent!' return procnumif __name__ == '__main__': jobs = [] for i in range(5): p = multiprocessing.Process(target=worker, args=(i,)) jobs.append(p) p.start() for proc in jobs: proc.join() print jobs
Output:
0 represent!1 represent!2 represent!3 represent!4 represent![<Process(Process-1, stopped)>, <Process(Process-2, stopped)>, <Process(Process-3, stopped)>, <Process(Process-4, stopped)>, <Process(Process-5, stopped)>]
I can't seem to find the relevant attribute in the objects stored in jobs
.