Answers for "python script that executes at time"

1

python script that executes at time

import schedule
import time

def job(t):
    print "I'm working...", t
    return

schedule.every().day.at("01:00").do(job,'It is 01:00')

while True:
    schedule.run_pending()
    time.sleep(60) # wait one minute
Posted by: Guest on April-08-2021
0

python script that executes at time

from datetime import datetime
from threading import Timer

x=datetime.today()
y=x.replace(day=x.day+1, hour=1, minute=0, second=0, microsecond=0)
delta_t=y-x

secs=delta_t.seconds+1

def hello_world():
    print "hello world"
    #...

t = Timer(secs, hello_world)
t.start()
Posted by: Guest on April-08-2021

Code answers related to "python script that executes at time"

Python Answers by Framework

Browse Popular Code Answers by Language