Petr Jakes wrote:
> 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.
> 
> minutes=time.localtime()[4]
> while 1:
>     min, sec = time.localtime()[4:6]
>     if  sec==0 and minutes!=min: # first occur of sec==0 only!! polling
> 10x a second
>         minutes=min
>         print "Eureca"
>     time.sleep(0.1)
> 
> Regards
> 
> Petr Jakes
> 
What platform?  If it is Windows, they write your application
as a Windows Service and have it sleep for however long you
want.  It won't impact your system looping and sleeping.
It will also be asynchronous, as it will sleep for time you
specify, run your code to completion and then sleep again
which isn't the same as running every one minute.

If it is Linux, others have answered separately.

-Larry Bates
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to