D
D
demsp2018-08-17 08:29:47
Python
demsp, 2018-08-17 08:29:47

How to apply key handling facilities in Python?

In IDLE command

>>> import msvcrt
>>> msvcrt.getch()

Displays immediately b'\xff'
What does b'\xff' mean (I did not press anything)
Code
from msvcrt import getch
while True:
    print(ord(getch()))

Goes into an endless loop. How to make sure you don't leave?
Code (in IDLE)
n = input()
print(n)

accepts only numbers. How to make letters accepted?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chupasaurus, 2018-08-17
@chupasaurus

Keyboard .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question