Wait/Delay

Greg Fortune gfortune at micron.net
Sat Jul 8 16:42:56 EDT 2000


And it sure can be improved.  I was playing around with it last night and
realized I was being silly to go through all the conversion stuff...
time.sleep(time.localtime(time.time())[5])
The [5] just pulls the seconds out of the time.localtime()'s return value.

Greg

Greg Fortune <gfortune at micron.net> wrote in message
news:K0y95.52$md2.24497 at news01.micron.net...
> And put this in a while loop and a statement will only execute on the
> minute...  That allows you to run a statement at predefined intervals
> regardless of how long the command takes (as long as it takes less than a
> minute or 5 or 60 or whatever you set it to)  For example, I wanted to run
a
> ping once a minute.  If I just time.sleep(60) or time.sleep(45) even, the
> ping will not always take the same amount of time.  Here's the code :)
>
> time.sleep(60 - string.atoi(time.strftime('%S',
> time.localtime(time.time()))))
>
> and btw, this can probably done cleaner.  I did this the second day I used
> Python <g>
>
> Greg
> Stephen Hansen <stephen at cerebralmaelstrom.com> wrote in message
> news:F1595.115780$WS3.1008506 at typhoon.we.rr.com...
> > >>> import time
> > >>> time.sleep(1)
> >
> > There :)
> >
> > --Stephen :)
> >
> > A J Wilson <wilson.austin.aj at bhp.com.au> wrote in message
> > news:8k2lhd$5i6$1 at gossamer.itmel.bhp.com.au...
> > > Hi
> > >
> > > Is there a command/function in python to put a delay or wait step into
a
> > > program?
> > >
> > > Thanks
> > > Austin
> > >
> > >
> >
> >
>
>





More information about the Python-list mailing list