How can I make a time delay in Python?

Spread the love

Question Description

I would like to know how to put a time delay in a Python script.

Practice As Follows

import time
time.sleep(5)   # delays for 5 seconds. You can Also Use Float Value.

Here is another example where something is run approximately once a minute:

import time 
while True:
    print("This prints once a minute.")
    time.sleep(60)   # Delay for 1 minute (60 seconds).

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.