python run python script at given time code example
Example 1: find time of run for python code
import time
start_time = time.time()
main()
print("--- %s seconds ---" % (time.time() - start_time))
Example 2: 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()