I have a program (temptrack) where I need to download weather data every x minutes in x hours. I figured out how to download every x minutes using time.sleep(x*60), but I don’t know how to repeat this process for a certain number of hours.
UPDATE: Thanks to everyone who posted the solution. I noted an example using "datetime.datetime.now () + datetime.timedelta (hours = x)" as the best answer, because I could better understand it, and it seems to work very well for my purpose.
Erikt source
share