Ok the title is a bit weird. But, basically what i want to ask is:
read = input("Enter some numbers: ")
# The user should only enter numbers and nothing else
But the thing is the user can enter something else other than a numerical value. How do i stop someone from entering an alphabet in realtime from the terminal?
Lets say the user inputs 123 then enters an "e". How do i make this e not even appear on the terminal even if the user presses the e key?
CodePudding user response:
you can repeat asking int values if user enters a string.
while True:
try:
#