2020
09-28
09-28
python继承threading.Thread实现有返回值的子类实例
继承与threading.Thread实现有返回值的子类MyThread,废话不多说,大家直接看代码importthreadingclassMyThread(threading.Thread):def__init__(self,func,args=()):super(MyThread,self).__init__()self.func=funcself.args=argsdefrun(self):self.res=self.func(*self.args)defgetResult(self):try:returnself.resexceptException:returnNone补充知识:python3多线程...
继续阅读 >