Asa*_*saf 3 python timer scheduled-tasks
我想运行一个每4小时运行一次函数的程序.这种方式消耗最少的方法是什么?
ros*_*dia 5
我能想到的最简单的方式(在python中,因为帖子用python标记):
import time while True: do_task() time.sleep(4 * 60 * 60) # 4 hours * 60 minutes * 60 seconds
小智 5
您可以使用sched模块
sched
这是文档
https://docs.python.org/3.4/library/sched.html
归档时间:
15 年,5 月 前
查看次数:
6693 次
最近记录:
6 年,3 月 前