Python Time Sleep() Method



Python time scheme sleep() dangles carrying out for the specified number of seconds. The row may be a suspended point number to specify a more accurate sleep time. The definite suspension time may be fewer than that demanded since any caught signal will conclude the sleep() subsequent execution of that signal's catching routine.


Following is the syntax for sleep() method:



  • t − This is the number of seconds of execution to be suspended.

Return Value

This method does not return any value.


The following example shows the usage of sleep() method.

import time

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

When we run the above program, it produces the following result:

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

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.