String Methods
str.isdigit()
Recognize nonempty strings of Unicode characters with Numeric_Type Digit or Decimal. Includes ordinary decimal digits and compatibility digits such as superscripts. Broader than isdecimal(), narrower than isnumeric(). Passing this test is not a guarantee of integer conversion. Takes no arguments.
Formal Syntax & Structure
python syntaxpython
text.isdigit()Return Value
bool
True when the stated classification holds; otherwise False.
Working Example
Example Snippetpython
for text in ("۴۲", "²", "Ⅷ", "-2"): print(text, text.isdigit(), text.isdecimal())