I am writing a program in python and I would like to make sth like this:
“execute something when it’s X o’clock, e.g.: print “hi” when it’s 17:56”
What I tried is:
import datetime if datetime.datetime.now().strftime("%H:%M") == "17:55": print("hi")
However, this just passed and ignored the if statement - the code ended immediately after it was started and it did not print “hi” at 17:55
Does anyone know how to deal with this?