定时执行某方法
import schedule
import time
schedule.every(x).minutes.do(function_self,argument1,argument2) #部署每x分钟执行一次函数的任务
#schedule.every(x).hour.do(function_self,argument1,argument2) #部署每x小时执行一次j函数的任务
#schedule.every().day.at(x).do(function_self,argument1,argument2) #部署在每天的10:30执行函数的任务
#schedule.every().monday.do(function_self,argument1,argument2) #部署每个星期一执行函数的任务
#schedule.every().wednesday.at(x).do(function_self,argument1,argument2) #部署每周三的
while True:
schedule.run_pending()
time.sleep(1)
1.本篇所有数据文件小博已上传,需要的小伙伴到“文件”进行下载使用。数据文件纯属学习教学所用,纯属虚构。
2.文章中的代码都是经过小博的真实操作,可以执行。(注:Anaconda3的Jupyter notebook)
浙公网安备 33010602011771号