from apscheduler.schedulers.blocking import BlockingScheduler
from datetime import datetime
def test_tick():
print(f'time is {datetime.now()}')
if __name__ == '__main__':
scheduler = BlockingScheduler()
scheduler.add_job(test_tick, 'interval', seconds=5)
try:
scheduler.start()
except(KeyboardInterrupt, SystemExit):
pass
标签:__,105281804,relevant,Python,datetime,blog,pc,任务,定时 From: https://www.cnblogs.com/czzz/p/16893728.htmlhttps://blog.csdn.net/somezz/article/details/83104368?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2~default~CTRLIST~Rate-1-83104368-blog-105281804.pc_relevant_3mothn_strategy_recovery&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2~default~CTRLIST~Rate-1-83104368-blog-105281804.pc_relevant_3mothn_strategy_recovery&utm_relevant_index=2
https://blog.csdn.net/weixin_43897615/article/details/105281804