Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python script to do something at the same time every day

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()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Python #script #time #day
ADD COMMENT
Topic
Name
8+2 =