在python中以特定时间间隔运行任务

在python中以特定时间间隔运行任务

问题描述:

可能的重复:
对 Python 中类似 Cron 的调度程序的建议?

安排函数作为后台任务定期运行的最pythonic方法是什么?有一些想法这里,但在我看来它们都相当丑陋.并且不完整.

What would be the most pythonic way to schedule a function to run periodically as a background task? There are some ideas here, but they all seem rather ugly to me. And incomplete.

java Timer 类有一个非常完整的解决方案.有人知道类似的python类吗?

The java Timer class has a very complete solution. Anyone know of a similar python class?

有一个方便的事件调度程序可以满足您的需求.这是文档的链接:

There is a handy event scheduler that might do what you need. Here's a link to the documentation:

http://docs.python.org/library/sched.html