About 47,300 results
Open links in new tab
  1. How to make a Python program wait? - GeeksforGeeks

    Apr 17, 2025 · How to make a Python program wait? The goal is to make a Python program pause or wait for a specified amount of time during its execution. For example, you might want to print a message, but only after a 3-second delay.

  2. python - How do I make a time delay? - Stack Overflow

    If you would like to put a time delay in a Python script: Use time.sleep or Event().wait like this: from threading import Event from time import sleep delay_in_sec = 2 # Use time.sleep like this sleep(delay_in_sec) # Returns None print(f'slept for {delay_in_sec} seconds') # Or use Event().wait like this Event().wait(delay_in_sec) # Returns ...

  3. Python sleep(): How to Add Time Delays to Your Code

    In this tutorial, you'll learn how to add time delays to your Python programs. You'll use decorators and the built-in time module to add Python sleep() calls to your code. Then, you'll discover how time delays work with threads, asynchronous functions, and graphical user interfaces.

  4. sleep - Correct way to pause a Python program - Stack Overflow

    Nov 8, 2020 · For a long block of text, it is best to use input() (or raw_input() on Python 2.x) to prompt the user, rather than a time delay. Fast readers won't want to wait for a delay, slow readers might want more time on the delay, someone might be interrupted while reading it and want a lot more time, etc.

  5. Python’s time.sleep() – Pause, Stop, Wait or Sleep your Python

    A look into Python's time.sleep() function - by letting you pause, wait, sleep, or stop your Code. We look at the syntax, an example and the accuracy.

  6. How to Use wait() Function in Python? - Python Guides

    Jan 6, 2025 · Learn how to use the `wait()` function in Python with threading or event handling to pause execution. This guide covers syntax, examples, and applications. Skip to content

  7. How to Wait for a Specific Time in Python? - AskPython

    May 18, 2020 · However, if you want a particular function to wait for a specific time in Python, we can use the threading.Timer() method from the threading module. We’ll show a simple example, which schedules a function call every 5 seconds.

  8. Make Python Program Wait - Stack Overflow

    Mar 18, 2013 · Use the time library and use the command time.sleep() to make it wait. It's more efficient when choosing to extract it from the time library and then use just sleep() For Example: import time print('hi') time.sleep(0.2) print('hello')

  9. Python Sleep Methods | How to Make Code Pause or Wait

    Aug 20, 2024 · TL;DR: How Do I Make Python Wait or Pause in My Code? To pause or delay execution in Python, you can use the sleep() function from Python’s time module: time.sleep(5). This function makes Python wait for a specified number of seconds. Here’s a simple example:

  10. How To Make Python Wait - miguelgrinberg.com

    Feb 5, 2019 · In this article I'm going to show you a few different ways to wait. I'm going to use Python for all the examples, but the concepts I'm going to present apply to all programming languages. To show you these wait patterns, I'm going to use an example application, shown below: import threading. import time.

Refresh