String Methods

str.isnumeric()

Recognize nonempty text whose characters have Unicode Numeric_Type Decimal, Digit or Numeric. This includes numeric symbols such as fractions and Roman numerals. It does not parse signs, decimal points or arithmetic expressions, and numeric symbols need not be accepted by int() or float(). Takes no arguments.

Formal Syntax & Structure

python syntaxpython
text.isnumeric()

Return Value

bool

True when the stated classification holds; otherwise False.

Working Example

Example Snippetpython
for text in ("۴۲", "²", "Ⅷ", "½", "3.5"):    print(text, text.isnumeric(), text.isdigit())
Python Reference