The isnumeric Method in Python: Checking if a String Contains Numeric Characters

Returns True or False, indicating whether a string contains only numbers.

isnumeric()

Returns True if the string contains characters and all are numeric.

''.isnumeric()  # False
'a'.isnumeric()  # False
'0'.isnumeric()  # True
'10'.isnumeric()  # True
'⅓'.isnumeric()  # True
'Ⅻ'.isnumeric()  # True

Numeric characters include digits and any characters with a numeric property in Unicode, such as U+2155 (VULGAR FRACTION ONE FIFTH). These are characters where the Numeric_Type property is set to Digit, Decimal, or Numeric.