1
在Python中使用計劃包時,我想要安排任務在特定時間啓動,然後每10秒運行一次。我能夠使用schedule.every(10).seconds.do(x)
每10秒運行一次任務,並且我還使用schedule.every().day.at('13:25').do(x)
在設定的時間運行了該任務。但是我怎麼把這些放在一起呢?我試圖將它們組合成以下,但我得到了RecursionError: maximum recursion depth exceeded
計劃任務在特定時間開始每n秒運行
import schedule
import time
def test():
print('Hello, World!')
def sched_job():
schedule.every(10).seconds.do(test)
while True:
schedule.run_pending()
time.sleep(1)
schedule.every().day.at('13:56').do(sched_job)
while True:
schedule.run_pending()
time.sleep(1)
sched_job()
的(http://stackoverflow.com/questions/26774186/looping-at-a [以恆定速率以高精度對信號採樣循環]可能的複製的常數 - 率 - 用高精度換信號採樣) –