Python time sleep() method
Description
The Python time sleep() function delays the execution of the calling thread. The secs parameter specifies the number of seconds, indicating how long the process is suspended.
Syntax
sleep() method syntax:
time.sleep(t)
Parameters
- t -- the number of seconds to delay execution.
Return Value
This function has no return value.
Example
The following example shows how to use the sleep() function:
Example
#!/usr/bin/python
import
time
"
Start : %s
"
%
time
.
ctime
(
)
time
.
sleep
(
5
)
"
End : %s
"
%
time
.
ctime
(
)
The output of the above example is:
Start : Tue Feb 17 10:19:18 2013
End : Tue Feb 17 10:19:23 2013