How would I do a "hit any key" (or grab a menu option) in Python?
- raw_input requires you hit return.
- Windows msvcrt has getch() and getche().
Is there a portable way to do this using the standard libs?
How would I do a "hit any key" (or grab a menu option) in Python?
Is there a portable way to do this using the standard libs?
I implemented it like the following in Windows.
getch() takes a one single character
import msvcrt
char = 0
print 'Press any key to continue'
while not char:
char = msvcrt.getch()
Another option:
import keyboard
print("Press any key to continue")
keyboard.read_key()
print("to be continued...")