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 = t
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 = t
On 2006-05-09, Petr Jakes <[EMAIL PROTECTED]> wrote:
> I would like to do "some action" once a minute.
You can try the sched module (import sched).
You give it a time at which to call a callback. Then in the callback you
can reset the "alarm" for a minute later,
This is why your best bet is probably threads.
Class Eureka(Threading.Thread):
def __init__(self):
Threading.Thread.__init__(self)
self.start()
def run(self,sleep_time):
while 1:
time.sleep(sleep_time)
print "eureka"
--
http://mail.python.o
Petr Jakes wrote:
> OK, to be more specific, I would like to run the code, when the value
> of seconds in the timestamp become say "00".
> The whole code will run in the infinitive loop and other actions will
> be executed as well, so it can not "sleep" for 60 seconds :).
Have a look at my 'Kronos
Petr Jakes wrote:
> Thanks for your comment. It is mainly English issue (I am not native
> English speaker).
>
> OK, to be more specific, I would like to run the code, when the value
> of seconds in the timestamp become say "00".
> The whole code will run in the infinitive loop and other actions
Thanks for your comment. It is mainly English issue (I am not native
English speaker).
OK, to be more specific, I would like to run the code, when the value
of seconds in the timestamp become say "00".
The whole code will run in the infinitive loop and other actions will
be executed as well, so it
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 f
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: # f