Keys To The Kingdom
Tim Daneliuk
tundra at tundraware.com
Sun Jul 8 20:14:11 EDT 2001
I have a two part question about accepting keyboard input in python:
Is there a standard way to read one keystroke at a time rather than
doing line input via raw_input()?
For some reason, I cannot seem to catch Ctrl-C when it is typed in response
to a raw_input() call. This code still blows out of the python interpreter
when the user keys in Ctrl-C:
try:
x=raw_input()
except KeyBoardInterrupt:
# Handle the Ctrl-C and regroup
...
------------------------------------------------------------------------------
Tim Daneliuk
tundra at tundraware.com
More information about the Python-list
mailing list