python的定时任务模块--schedule

首先先安装一下模块

下面我们简单的学习一下schedule模块

先简单的看个示例

    import schedule

    def test(*args,**kwargs):
        print("hello world 1",datetime.datetime.now())


    schedule.every(1).minute.do(test)


    while True:
        schedule.run_pending()

  

结果如下

猜你喜欢

转载自www.cnblogs.com/bainianminguo/p/10325169.html
今日推荐