this is the code:
import datetime
import schedule
import time
local = datetime.datetime.now().time().replace(microsecond=0)
hour = str(local)
def job():
if hour.startswith('16'):
print("Hi! It's ", local)
else:
print("nope!")
schedule.every(10).minutes.do(job)
while True:
schedule.run_pending()
time.sleep(1)
I'm trying to repeat job (if current hour starts with 16 then say hi it's local , if it doesn't say nope) every 10 minutes, but it gives the same response every time, example, started the code at 16:40, gives right answer (hi it's local) but after 17:00 it still gives the same answer with the old time instead of just saying nope (or the right time), I'm not sure if the schedule code is right, need some help, ty!