Categories
Python Answers

How to make a time delay in Python?

Spread the love

Sometimes, we want to make a time delay in Python.

In this article, we’ll look at how to make a time delay in Python.

How to make a time delay in Python?

To make a time delay in Python, we can use the sleep function from the time module.

For instance, we write:

from time import sleep
print('foo')
sleep(0.1) 
print('bar')

We call the sleep with the number of seconds to pause the program for.

Conclusion

To make a time delay in Python, we can use the sleep function from the time module.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *