python 多进程-03 进程池

from concurrent.futures import ProcessPoolExecutor

import time


def task(a1,a2):
    time.sleep(1)
    print("{},{}".format(a1, a2,))


if __name__ == '__main__':
    # 定义进程池
    pool = ProcessPoolExecutor(10)
    for i in range(100):
        # 申请进程池中的线程
        pool.submit(task, i, 8)

posted @ 2020-03-11 14:05  hurz  阅读(126)  评论(0编辑  收藏  举报