Loading

Pool-basic-test

  1. from multiprocessing import Pool
  2. import multiprocessing
  3.  
  4. def cube(x):
  5.   return x**3
  6.  
  7. pool = multiprocessing.Pool(processes = 1)
  8. results = [pool.apply(cube, args=(x,)) for x in range (1, 7)]
  9.  
  10. print(results)

Comments