python 进程池pool.map
from multiprocessing import Pool
def double(x):
print(x**2)
return x**2
if __name__ == '__main__':
pool = Pool()
pool.map(double, list(range(11)))
print(list(map(double,list(range(11)))))
输出
0
1
4
9
25
16
36
49
64
100
81
0
1
4
9
16
25
36
49
64
81
100
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
写入自己的博客中才能记得长久