mvrpl
2/17/2020 - 12:27 PM

MultiProcessing

import multiprocessing, time

def f(i):
    print("asdasd")
    if i == "hihi":
        time.sleep(10)
    else:
        time.sleep(60)

with multiprocessing.Pool(2) as p:
    p.map(f, ["uhuhu", "hihi", "hahaha", "asdsd", "sdasdsd"])