python publish regular tasks (schedule module)

Recently the company started to make on their own developed software to write the log, there are several off duty forgot to write several times to the leadership of all e-mail, to explain that he did not write the log it, a lot of trouble. But I think I have to write every day, is it too much trouble, think about reptiles experience before himself, why he did not write one set of code, so this code it yourself Officer. Thus, I began to wonder task timer. So we have to learn today timer module.

import schedule
def job(name):
    print("her name is : ", name)
    
name = "longsongpong"

schedule.every ( 10) .minutes.do (the Job, name)    # every ten minutes to perform a task 
schedule.every (). hour.do (the Job, name)    # every hour to perform a task 
schedule.every () .day.at ( " 10:30 " ) .do (the job, name)    # every day at 10:30 to perform a task 
schedule.every (5) .to (10) .days.do (the job, name)    # every 5-10 days to perform a task 
schedule.every (). monday.do (the job, name)    # every Monday at this time to perform a task 
schedule.every (). wednesday.at ( " 13:15 " ) .do (the job , name)    # Wednesday 13:15 perform a task

while True:
    schedule.run_pending ()    # run_pending: run all tasks can be run

Do not pull, I hope not to be found

Guess you like

Origin www.cnblogs.com/hahahu/p/11987958.html