# How can I make a time delay in Python?

PythonServer Side ProgrammingProgramming

In order to introduce delay of definite interval, we can use sleep() function that is available in time module of Standard Python library. The sleep() function takes an integer number corresponding to seconds as an argument.

time.sleep(sec)

## Example

In following example, current time is first displayed and then the execution is paused for 10 seconds using sleep() function.

import time
print ("current time : ",time.ctime())
time.sleep(10)
print ("after 10 sec : ",time.ctime())
Published on 26-Dec-2017 19:17:10
Advertisements