How To Make Python Do Something Every Half An Hour?
I would like my code (Python) to execute every half an hour. I'm using Windows. For example, I would like it to run at 11, 11:30, 12, 12:30, etc. Thanks
Solution 1:
This should call the function once, then wait 1800 second(half an hour), call function, wait, ect.
fromtime import sleep
from threading import Thread
def func():
your actual code code here
if __name__ == '__main__':
Thread(target = func).start()
while True:
sleep(1800)
Thread(target = func).start()
Solution 2:
You can also use the AT command in the command prompt, which is similar to cron in linux.
Post a Comment for "How To Make Python Do Something Every Half An Hour?"