美文网首页
python 定时任务

python 定时任务

作者: 默默_小鱼 | 来源:发表于2022-07-28 13:21 被阅读0次

import datetime

from threadingimport Timer

def time_printer():

    now = datetime.datetime.now()

    ts = now.strftime('%Y-%m-%d %H:%M:%S')

    print('do func time :', ts)

def loop_monitor(times, fun):

    t =Timer(times, fun)

    t.start()

loop_monitor(5, time_printer)

相关文章

网友评论

      本文标题:python 定时任务

      本文链接:https://www.haomeiwen.com/subject/ewqqwrtx.html