Spawn parallel processes for function and pass several different arguments to function
问题 Hi everybody I took Jiaaro's solution as a template to convert it from threading to multiprocessing: import multiprocessing from function_repo import run from time import time vitems = ['02','63','25','0'] num_processes = (multiprocessing.cpu_count()/1) threads = [] if __name__ == '__main__': begin = time() print begin # run until all the threads are done, and there is no data left while threads or vitems: if( len(threads) < (num_processes -1) ): p = multiprocessing.Process(target=run,args=