I want that loop start at 00 min and 2 sec or 05 min and 2 sec or 10 min and 2 sec, etc...
I have code which work but i feel so stupid because i think this can be solved in a better way. not the gopnik style.
How can I do it?
def time_now():
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
print("Current Time =", current_time)
while True:
now = datetime.now()
while ( now.minute == 0 and now.second == 2) \
or ( now.minute == 5 and now.second == 2) \
or ( now.minute == 10 and now.second == 2) \
or ( now.minute == 15 and now.second == 2) \
or ( now.minute == 20 and now.second == 2) \
or ( now.minute == 25 and now.second == 2) \
or ( now.minute == 35 and now.second == 2) \
or ( now.minute == 40 and now.second == 2) \
or ( now.minute == 45 and now.second == 2) \
or ( now.minute == 50 and now.second == 2) \
or ( now.minute == 55 and now.second == 2):
time_now()
#print("Current Time =", current_time)
print('Something')
time.sleep(300)