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]
标签:__,map,25,python,64,81,pool
From: https://www.cnblogs.com/heris/p/17809871.html