About 35,900,000 results
Open links in new tab
  1. 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.

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

    There are five methods which I know: time.sleep(), pygame.time.wait(), matplotlib's pyplot.pause(), .after(), and asyncio.sleep(). time.sleep() example (do not use if using tkinter): import time print('Hello') time.sleep(5) # Number of seconds print('Bye')

  3. time.sleep() in Python - GeeksforGeeks

    Aug 18, 2022 · Python time sleep () function suspends execution for the given number of seconds. sec : Number of seconds for which the code is required to be stopped. Returns : VOID.

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

    Nov 8, 2020 · Simply use print to display the long block of text and then input() or raw_input('Press <ENTER> to continue') as appropriate for your version of Python. For a long block of text, it is best to use input() (or raw_input() on Python 2.x) to …

  5. The Definitive Guide to time.sleep() in Python – TheLinuxCode

    Dec 22, 2024 · In this comprehensive guide, you‘ll gain an in-depth understanding of time.sleep (), its capabilities, when to use it, and even how it works behind the scenes. Let‘s dig in! The time module itself dates back to Python 1.4 in the early 1990s and provided basic functions for accessing timestamps and durations.

  6. How to add time delay in Python? - GeeksforGeeks

    Apr 7, 2023 · In order to add time delay in our program code, we use the sleep () function from the time module. This is the in-built module in Python we don’t need to install externally. Time delay means we are adding delay during the execution time in our program code.

  7. Python time.sleep(): Add Delay to Your Code (Example)

    Jan 25, 2024 · The time.sleep() function in Python serves as a simple yet powerful tool to introduce delays or pauses, allowing developers to manage execution timing, synchronize processes, and create more responsive applications.

  8. Python time.sleep(): Add Delay to Your Code (Example) - Guru99

    Aug 12, 2024 · Python sleep() function will pause Python code or delay the execution of program for the number of seconds given as input to sleep(). The sleep() function is part of the Python time module. You can make use of Python sleep function when you want to temporarily halt the execution of your code.

  9. Python sleep() | Function Guide (With Examples)

    Aug 28, 2023 · TL;DR: How Do I Make a Python Program Sleep? The answer is simple: Use the sleep() function from Python’s time module. Here’s a quick example: print('Hello, World!') # 'Hello, World!' This snippet of code will cause the program to …

  10. How to Make a Time Delay in Python Using the sleep() Function

    Jan 8, 2020 · That's where Python's time module comes in. time is part of Python's standard library, and contains the helpful sleep() function that suspends or pauses a program for a given number of seconds: for letter in 'hello, world!': time.sleep(2) # sleep 2 seconds between each print. print(letter) Output:

  11. Some results have been removed
Refresh