Learn to Code via Tutorials on Repl.it!

← Back to all posts
Learning about using time.sleep() to make your program wait
17prabkann (3)

Use 'import time' to import time function. Then when u need to use it use the line 'time.sleep()' to make the program to wait for specific amount of time. For example:
import time
print("Make sure that you add a number of seconds to make it actually wait!")

AllAwesome497 (387)

Time.sleep is good, but it is bad to use in any web application, since it freezes the entire application instead of a single task. asyncio.sleep pauses a single task only, making it useful (on certain occasions) in web applications.