String Methods
isdigit()
Check whether every character is a digit, including some special digit characters.
str.isdigit()
Check whether every character is a digit, including some special digit characters.
Returns
True when the string is non-empty and all characters are digits; otherwise False.
Try it
Run it and change it
text = "²" print(text.isdigit())
Worth knowing
isdigit()accepts more characters thanisdecimal(), such as superscript 2.isnumeric()accepts an even wider set.