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!

Comments

Popular posts from this blog

Append to a json file python

Setup Mailhog mail server on Ubuntu