This code would perform error handling if the input was, "Type a number".
while True:
try:
a = int(input("Type a number."))
except ValueError: #etc. with "float(input" and stuff. But you know that.
print("That is an invalid input. Try again.")
continue
else:
break
And etc, etc.
But how would I perform error handling to check if something is in the format, for example, let's try to check whether or not the input is in the format <single letter **************> </> <number ******************> (the * and spaces are just so that the phrase I type won't disappear)? As an example to the format, something like f/16
.
The code which I presume should be correct is something similar to the above code, just replacing ValueError with something. However, if I am wrong, what is it meant to be?