每五分钟一次调度

需要安装schedule模块,该模块网址:https://pypi.org/project/schedule/

import schedule
import time
import sys

def job():
    print time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

schedule.every(5).minutes.do(job)

while True:
    schedule.run_pending()
    time.sleep(1)
posted @ 2018-08-16 15:00  Coye  阅读(173)  评论(0编辑  收藏  举报