在python中以特定时间间隔运行任务 [英] Run a task at specific intervals in python

查看:32
本文介绍了在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

这篇关于在python中以特定时间间隔运行任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆