Python time sleep() Method


Contents

Description

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.

Syntax

Following is the syntax for sleep() method:

time.sleep(t)

Parameters

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

Return Value

This method does not return any value.

Example

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

#!/usr/bin/python
import time

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

When we run above program, it produces 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.



Navigation
Tutorial
Tutorial
Tutorial