问题描述
我尝试过这种方式,但延迟实际上略多于一秒。 代码:
import time
from threading import Thread,Timer
def RepeatedTimer(interval,function):
Timer(interval,RepeatedTimer,args=(interval,function)).start()
function()
def hello():
print('hellow~')
print(time.time())
Thread(target=RepeatedTimer,args=(1,hello)).start()
我得到的结果:
你好~ 1608864807.9801986 你好~ 1608864808.9911985 你好~ 1608864809.9932015 你好~ 1608864811.002202 你好~ 1608864812.010207 你好~ 1608864813.017205 你好~ 1608864814.0252082 你好~ 1608864815.0312068
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)