import schedule
import time
#引入schedule和time模块
def job():
print(“I’m working…”)
#定义一个叫job的函数,函数的功能是打印’I’m working…’
schedule.every(2).seconds.do(job) #每2s执行一次job()函数(job函数是需要执行的函数体)
while True:
schedule.run_pending()
time.sleep(1)
来源:CSDN
作者:weixin_30662847
链接:https://blog.csdn.net/weixin_30662847/article/details/103462106