Latest web development tutorials

Python time sleep () method

description

Python time sleep () function to postpone the calling thread is running, you can refer to the number of seconds by parameter secs, it represents the process pending the time.

grammar

sleep () method syntax:

time.sleep(t)

parameter

  • t - the number of seconds to postpone the execution.

return value

This function has no return value.

Examples

The following example shows the sleep () function to use:

#!/usr/bin/python
import time

print "Start : %s" % time.ctime()
time.sleep( 5 )
print "End : %s" % time.ctime()

The above example output is:

Start : Tue Feb 17 10:19:18 2013
End : Tue Feb 17 10:19:23 2013