This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing import Pool | |
from multiprocessing.dummy import Pool as ThreadPool | |
def f(x): | |
print("Test {}".format(str(x))) | |
pool = ThreadPool() | |
# pool = Pool() for process pool | |
pool.map(f, range(100)) | |
pool.close() | |
pool.join() |
沒有留言:
張貼留言