Janusz Janusz - 3 months ago 7
Python Question

How do I make python to wait for a pressed key

I want my script to wait until the user presses any key.

How do I do that?


In Python 3, no raw_input() exists. So, just use:

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

This only waits for a user to press enter though, so you might want to use msvcrt ((Windows/DOS only) 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():

This should wait for a key press.