1. 首页
  2. 数据库
  3. 其它
  4. python获取多线程及子线程的返回值

python获取多线程及子线程的返回值

上传者: 2020-12-31 07:22:18上传 PDF文件 51.69KB 热度 16次
最近有个需求,用多线程比较合适,但是我需要每个线程的返回值,这就需要我在threading.Thread的基础上进行封装 import threading class MyThread(threading.Thread): def __init__(self,func,args=()): super(MyThread,self).__init__() self.func = func self.args = args def run(self): self.result = self.func(*self.args) def get_result(self): tr
用户评论