I have a Python script and I want too run it at 3 am. Would like to simply put something like this at the top of it.
while not 3am:
Solution with a sleep-wait loop:
import datetime import time target_time = datetime.datetime(2017, 3, 7, 3) # 3 am on 3 July 2017 while datetime.datetime.now() < target_time: time.sleep(10) print('It is 3am, now running the rest of the code')