do "some action" once a minute

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Tue May 9 08:59:48 CEST 2006


Petr Jakes enlightened us with:
> I would like to do "some action" once a minute. My code (below)
> works, I just wonder if there is some more pythonic approach or some
> "trick" how to do it differently.

I'd use the Threading module, and the Timer object from that module to
be more precise. There you can simply say "call this function in 60
seconds" or something similar. Then your program just sleeps until
it's time to call the function.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa



More information about the Python-list mailing list