In Python 3, use input():

input("Press Enter to continue...")

In Python 2, use raw_input():

raw_input("Press Enter to continue...")

This only waits for the user to press enter though.


On Windows/DOS, one might want to use msvcrt. The msvcrt module gives you access to a number of functions in the Microsoft Visual C/C++ Runtime Library (MSVCRT):

import msvcrt as m
def wait():
    m.getch()

This should wait for a key press.


Notes:

In Python 3, raw_input() does not exist.
In Python 2, input(prompt) is equivalent to eval(raw_input(prompt)).

Answer from riza on Stack Overflow
🌐
Network Direction
networkdirection.net › home › python › python resources › press enter to continue
Python - Press Enter to Continue
January 4, 2022 - import time print ('Waiting 5 seconds before continuing') time.sleep(5) If you want the script to wait until you’re ready, you can ask for user input. The simplest option here is to use input, which takes characters until the enter key is pressed:
Discussions

How to 'press any key to continue' in Python 3?
Correct, there is no easy way to do that in python. However curses and termios are not external dependencies, they are part of the python standard library. However a "press enter to continue" is very easy to do, can you use that instead? , I got the impression that there is usually "one single Python way of doing basic things". That is part of the zen of python and a dream we aspire to, but it's far from reality. More on reddit.com
🌐 r/learnpython
3
5
June 7, 2020
Solved: How to perform a key press 'Enter' in Python? - Autodesk Community
After most of the operation, I have to press 'Enter' to finish, 'Enter' is not in a easy position to press. Is that a way I can write a python script to perform a 'Enter' press? then binding it to 'SPACE', much more easy to press. I have already write some shortcut in Python to make it easy to work. More on forums.autodesk.com
🌐 forums.autodesk.com
June 13, 2025
How do I have a "press enter to continue" feature in python? - Stack Overflow
I am writing a choose-your-own-adventure style game in python (terminal based) and I would like the program to pause printing until the enter button is pressed. Here is an example. print("zzzzzzzz... More on stackoverflow.com
🌐 stackoverflow.com
Accepting the 'Return' key on keyboard as user input?
input = input("Press ENTER to start") If input == '' : ** your code here *** It's not really elegant because the user may write anything they want. Try looking for something similar to getch/getche() from C More on reddit.com
🌐 r/learnpython
10
1
October 22, 2021
🌐
GeeksforGeeks
geeksforgeeks.org › python › make-python-wait-for-a-pressed-key
Make Python Wait For a Pressed Key - GeeksforGeeks
July 23, 2025 - # The argument to the function may be any descriptive text input("Press the Enter key to continue: ")
🌐
Quora
quora.com › How-do-you-make-a-command-to-wait-for-the-user-to-press-ENTER-in-Python
How to make a command to wait for the user to press 'ENTER' in Python - Quora
Just type input(“Press enter to continue”) ... print("On the other board, your hits will appear as h, misses will appear as m, and everything else will appear as n") ... In Python, my program closes when I press the enter key.
🌐
Reddit
reddit.com › r/learnpython › how to 'press any key to continue' in python 3?
r/learnpython on Reddit: How to 'press any key to continue' in Python 3?
June 7, 2020 -

I'm a bit baffled because according to my brief search, there seems to be no general and platform-independent way of waiting for the user to press any key in Python 3:

  • 2017-11: https://www.reddit.com/r/learnpython/comments/7bij6z/how_to_press_any_key_to_continue_in_python_34/

  • 2009-09: https://stackoverflow.com/questions/1394956/how-to-do-hit-any-key-in-python

  • 2009-06: https://stackoverflow.com/questions/983354/how-do-i-make-python-wait-for-a-pressed-key

  • 2012-11: https://stackoverflow.com/questions/13207678/whats-the-simplest-way-of-detecting-keyboard-input-in-python-from-the-terminal answer 1 looks rather complicated

  • 2019-07: this would suggest an "if windows than m.getch() else input()"-approach. Is this the way to go?

I'd prefer not to use any external dependency for this kind of simple functionality and I'd like to use a (standard) method that works with Windows and non-Windows OS. So far, I got the impression that there is usually "one single Python way of doing basic things".

Thanks for your opinion on this. (I can only test Linux behavior at my side at the moment but my tools are supposed to run on Windows as well.)

🌐
DaniWeb
daniweb.com › programming › software-development › threads › 123777 › press-any-key-to-continue
python - Press Any Key to Continue | DaniWeb
import msvcrt def wait_any_key(prompt="Press any key to continue..."): print(prompt, end="", flush=True) while msvcrt.kbhit(): msvcrt.getch() # flush pending keys (e.g., prior Enter) msvcrt.getch() # now wait for a new key ... Use getwch() if you need Unicode key handling on Windows. curses is not available by default on Windows; if needed, install the Windows port via pip and test in a real console, not an IDE terminal. For background, see the Python docs for curses and msvcrt.
🌐
Pierian Training
pieriantraining.com › home › how to wait for a keypress in python
How to Wait for a Keypress in Python - Pierian Training
April 28, 2023 - The easiest way to wait for a keypress in Python is to use the built-in `input()` function. This function waits for the user to enter some text and press the Enter key. Once the user has pressed Enter, the function returns the entered text as ...
🌐
Autodesk Community
forums.autodesk.com › t5 › fusion-api-and-scripts-forum › how-to-perform-a-key-press-enter-in-python › td-p › 13194950
Solved: How to perform a key press 'Enter' in Python? - Autodesk Community
June 13, 2025 - from pynput.keyboard import Key, Controller keyboard = Controller() keyboard.press(Key.enter) keyboard.release(Key.enter) I wonder how are you going to trigger its execution: from where?
Find elsewhere
🌐
Reddit
reddit.com › r/learnpython › accepting the 'return' key on keyboard as user input?
r/learnpython on Reddit: Accepting the 'Return' key on keyboard as user input?
October 22, 2021 -

I want to start a simple text-based program by having the user press 'Return/Enter' to start. An 'if' loop will initiate when input == *whatever the return key value is**.

I've looked online and found the Unicode value for 'return' in Python. I tried assigning that value to const ENTER and having input == ENTER, but this doesn't work. I don't know how else to use the Unicode value to trigger the 'if' loop, or if I'm even on the right track with that.

Any other info I find is on how to use input() to return a value, how to return a key from a data set, etc. Any help or hints on where to look?

🌐
IQCode
iqcode.com › code › python › python-press-enter-to-continue
python press enter to continue Code Example
October 21, 2021 - input("You can't see the next text. (press enter)") # input() waits for a user input print("Now you can!")
🌐
Medium
medium.com › swlh › pass-break-and-continue-in-python-3-93c3ebe221b4
Pass, Break and Continue in Python 3 | by Josh Robin | The Startup | Medium
December 26, 2019 - Or, if this was a one-word sentence, the loop would continue all the way to the end of the string. This can be useful when you want a certain condition to stop a loop. A common way of using break in a while loop would be to keep a program running until the user decides to quit. To do this, you can set up a loop that starts with while True: and use break when you want the program to end. For example: while True: print('Press Enter to keep this program running') choice = input('or type anything to quit: ') if choice == '': print('\nStill running...\n') else: print('\nYou typed', choice) print('Quitting program...') break
🌐
Quora
quora.com › In-Python-my-program-closes-when-I-press-the-enter-key-How-can-I-fix-that
In Python, my program closes when I press the enter key. How can I fix that? - Quora
In Windows: ensure you press Enter, not Ctrl+Z+Enter (Ctrl+Z sends EOF). In some IDEs (PyCharm run configurations, VS Code tasks) the console may close on program exit; run the script in an integrated terminal instead of the “Run” tool window, or enable “Emulate terminal” so stdin is interactive. If you launched Python with input piped from a file (python script.py < file), the program will hit EOF when file ends.
🌐
Reddit
reddit.com › r/learnpython › [deleted by user]
[deleted by user] : r/learnpython
November 8, 2017 - Yes, i wrote user have 2 buttons to press. Enter is similar to return.
🌐
Saturn Cloud
saturncloud.io › blog › how-to-pause-a-for-loop-and-wait-for-user-input-in-matplotlib
How to Pause a For Loop and Wait for User Input in Matplotlib | Saturn Cloud Blog
December 28, 2023 - Let’s start by discussing how to pause a for loop. In Python, the input() function can be used to pause your program and wait for user input. Here’s a simple example: for i in range(10): print(i) input("Press Enter to continue...")
🌐
Medium
medium.com › @ericvanrees › python-workout-press-enter-to-exit-40dbff5e33f9
Python Workout — press enter to exit - Eric van Rees - Medium
September 20, 2022 - The following code snippet shows you multiple things. Mainly, it evaluates user input and evaluates that to either floats or empty strings in case no input is given and the user presses Enter to exit the while loop.