Janusz Janusz - 1 year ago 295
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download