Sleep How Can I Make a Time Delay in Python

The time module in the Python standard library contains the function sleep() which suspends a program for a given number of seconds.


import time

for letter in 'hello, world!':
    time.sleep(2)  # sleep 2 seconds between each print

Floating point numbers can be given as the argument to sleep() for more precise sleep times.

More Information:

Time module documentation on the sleep function.