import re regExPattern = re.compile("[0-9]") input1 = "5" if not re.fullmatch(regExPattern, input1): print("input is not a single digit")