[Solved] For Loop executed every 5 minutes for 24 hours


Something like this? The loop runs for (a little more than) twenty-four hours and sleeps for five minutes after each iteration.

from time import sleep, time

ONE_DAY = 24 * 60 * 60  # seconds
FIVE_MINUTES = 5 * 60  # seconds


start_time = time()

current_time = start_time
while current_time <= start_time + ONE_DAY - FIVE MINUTES:
    # Do something loopy here...

    time.sleep(FIVE_MINUTES)
    current_time = time()

1

solved For Loop executed every 5 minutes for 24 hours