Код: Выделить всё
import msvcrt
# validating input
def enteringMessage(message):
while True:
try:
# Convert the input to an integer
message = int(message)
# Check if the value is within the range
assert 1
Подробнее здесь: [url]https://stackoverflow.com/questions/79310853/how-to-detect-esc-while-input-in-python[/url]
Мобильная версия