Multi threading Python simple example
from multiprocessing import Pool
def f(x):
return x * x
if __name__ == '__main__':
with Pool(50) as p:
print(p.map(f, [1, 2, 3, 2, 4, 5, 6, 7, 8, 9, 19]))

SNAPPED!
from multiprocessing import Pool
def f(x):
return x * x
if __name__ == '__main__':
with Pool(50) as p:
print(p.map(f, [1, 2, 3, 2, 4, 5, 6, 7, 8, 9, 19]))
SEND TO YOURSELF, SAVE FOR LATER, OR SHARE WITH YOUR TEAM!
SNAPPED!
Comments
Post a Comment