threading.Timer 返回值
定义
import threading
class hy_Timer(threading.Timer):
def __init__(self, interval, function, args=[], kwargs={}):
self._original_function = function
super(hy_Timer, self).__init__(
interval, self._do_execute, args, kwargs)
def _do_execute(self, *a, **kw):
self.result = self._original_function(*a, **kw)
def join(self):
super(hy_Timer, self).join()
return self.result
调用
t = hy_Timer(0.3, 函数名)
t.start()
print(t.join())
本文来自博客园,作者:CodeYaSuo,转载请注明原文链接:https://www.cnblogs.com/hany-postq473111315/p/15179944.html