mysteriously nonfunctioning script - very simple

Peter Otten __peter__ at web.de
Sat Mar 26 14:19:37 EST 2005


Sean McIlroy wrote:

> Fair enough. Here's the verbose version:

> from time import sleep,time,localtime
> 
> wakeuptime = (7,00)
> ## I WANT TO BE WOKEN UP AT 7AM (FOR EXAMPLE)
> 
> onehourlater = (wakeuptime[0]+1, wakeuptime[1])
> ## ONE HOUR LATER THAN THAT IS 8AM
> 
> while not wakeuptime < localtime(time())[3:5] < onehourlater: sleep(3)

Maybe you are a little /impatient/ and want to change the above to

while not wakeuptime <= localtime(time())[3:5] < onehourlater: sleep(3)

That should wake you up roughly one minute earlier, and thus before you hit
Ctrl+C ...again. 

Peter




More information about the Python-list mailing list