I am wanting to make a program with different responses when you press a key. Is there any way that you can detect a key press in Python?
The program is like when you press 0
, it will say you pressed 0
and when you pressed ctrl-c
it will say that you interrupted the program, so on.
Can you do this in a while True:
loop as well?
Also, I don't want it to be like input
and I am using Linux (I don't want to have to use root
).