faqts : Computers : Programming : Languages : Python : Common Problems : Date / Time

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

144 of 163 people (88%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How can I make a python program "sleep" or pause for a moment?

Oct 23rd, 2002 06:20
Michael Chermside, Klaus Alexander Seistrup


Sometimes your computer just goes too fast. If you need to pause while 
polling, make one thread wait while others continue to compute, or if 
your Python program just runs too darn fast <wink>, then what you need 
is this:
>>> import time
>>> help(time.sleep)
Help on built-in function sleep:
sleep(...)
    sleep(seconds)
    Delay execution for a given number of seconds.  The argument may be
    a floating point number for subsecond precision.