首页 > 解决方案 > 我想在不同的时间创建线程

问题描述

我想使用一个在不同时间生成线程的函数,比如在创建和运行一个线程之后再去另一个线程等等......如果可能,请提供帮助

import threading

def job(id):
    # some job here according to id


def create_jobs():
    job_ids = [1, 2, 3, 5, 6, 9]
    for id in job_ids:
        thread = threading.Thread(target=job, agrs=[job_ids[id]])
        thread.start()

标签: pythonmultithreading

解决方案


推荐阅读