Skip to content

How to Pause a Program in Python

If you need to pause the execution of your Python program, then you can do the following:

Option 1 – Using time.sleep()

import time time_duration = 3.5 time.sleep(time_duration)
Code language: Python (python)

Option 2 – Using input()

name = input("Please enter your name: ") print("Name:", name)
Code language: Python (python)

Option 3 – Using os.system("pause")

import os os.system("pause")
Code language: Python (python)

See also  How to Copy Text to the Clipboard in Python
Tags:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x