Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

I've been using the input function as a way to pause my scripts

print("something") 

wait = input("PRESS ENTER TO CONTINUE.") 

print("something")

is there a formal way to do this?

2 Answers

0 votes
by (106k points)
edited by

You can use raw_input() in Python 2.X.  and alternatively, you could use time.sleep() if you want to pause for a certain number of seconds. See the code below:-

import time 

print("abc") 

time.sleep(4)

print("def") 

To know more about this you can have a look at the following video tutorial:-

0 votes
by (20.3k points)

For windows, you can try using the code given below:

import os

os.system("pause")

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 2, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
asked Sep 25, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer

Browse Categories

...