Skip to main content
 首页 » 编程设计

python之在 python 中以 1 小时的间隔运行一条线

2025年05月04日9傻小

我正在尝试完全在 python 中创建一个基于 espeak 的通话时钟

我想知道怎么跑

spk.speak('It is now <time>') 

每次系统命中时间都是 12:00 1:00 等

请您参考如下方法:

import time 
while True: 
    # sleep for the remaining seconds until the next hour 
    time.sleep(3600-time.time()%3600) 
    spk.speak('It is now <time>')