Wait/Delay

Greg Fortune gfortune at micron.net
Sat Jul 8 00:18:15 EDT 2000


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