text: You need to import and use a module called time. This module provides various time-related functions for Python users.
  Python sleep syntax
  The syntax is as follows
  import time
  time.sleep(1)
  time.sleep(N)
  The time.sleep() suspend execution of a script for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep time. The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following execution of that signalâ€™s catching routine. Also, the suspension time may be longer than requested by an arbitrary amount because of the scheduling of other activity in the system.
  Example: Put delay in a Python script
  Create a script called demo-sleep.py:
  Save and close the file. Run it as follows:
  $ chmod +x demo-sleep.py
  $ ./demo-sleep.py
  Sample outputs:
  Where,
  - Set an infinite loop using while True:
  - Get the current date and time using strftime() and display on screen.
  - Finally, add 1 second delay in a script using sleep(1).
  - Continue this procedure till user interrupts.
  What if the print statement takes 0.5 second to run; How would you solve to print out time every one second?
  Hi @Michal, you use the threading module to achieve this.
  For more informations:
  –
  –
  Have a question? Post it on our forum!