code
import os import time from concurrent.futures.process import ProcessPoolExecutor def test(n): print(f'n:{n}-os.getpid:{os.getpid()}') time.sleep(2) return 'helllo' def call_back(n): print(f'callback:n.result{n.result()}') if __name__ == '__main__': pool = ProcessPoolExecutor(5) print('zhu') t_list = [] for i in range(20): res = pool.submit(test, i) t_list.append(res) print(f't_list:{t_list}')
标签:__,list,print,result,进程,import,os From: https://www.cnblogs.com/tslam/p/17785149.html