-3

Let's say we have two commands:

print("Hello")
print("How are you?")

If we execute this, we will get these two sentences printed.

I want the command 2 to be executed after 5 seconds the command 1 is executed. Is it possible to achieve this in Python?

YakovL
  • 6,451
  • 11
  • 52
  • 82
  • please specify if you want to just wait for 5 seconds or run the second command in an async manner, meaning that if you put a 3d command after the 2d one, the will get executed in the order: `1, 3, [delay] 2` – YakovL Dec 18 '18 at 20:41
  • 2
    Possible duplicate of [Correct way to pause Python program](https://stackoverflow.com/questions/11552320/correct-way-to-pause-python-program) – takendarkk Dec 18 '18 at 20:41
  • Haven't checked it! Thanks for informing my mistake! – siddarth kothur Dec 18 '18 at 21:43

2 Answers2

1
import time     

print("Hello")
time.sleep(5)
print("How are you?")
Wes Doyle
  • 2,014
  • 3
  • 14
  • 30
1
import time
time.sleep(5)

see time

ehacinom
  • 6,550
  • 5
  • 37
  • 60