The widest numeric check — a superset of isdigit that accepts any character Unicode considers numeric.
String methodPython 1.0+Live demo
Common call
if s.isnumeric():
Returns
True or False
Replaces
isdigit when you also want Roman numerals, fractions, or superscripts
Watch out
does NOT mean "can be converted with int() or float()"; decimals ("3.14") return False
str.isnumeric()
→ bool
Demo
Live evaluation
Try:
Inputs
stringstrthe string to test
Output
'12345'.isnumeric()
True
isnumeric() is the WIDEST of the numeric check family. It returns True for anything Unicode classifies as having a numeric value — digits, fractions like ½ and ¾, Roman numerals like Ⅳ and Ⅻ, superscript numbers like ² and ³, and Arabic-Indic or Devanagari digits. It does NOT accept decimal points, minus signs, or spaces. "3.14" returns False (the dot is not numeric); "-42" returns False (the minus is not numeric).
Common patterns
Detect any Unicode number-shaped input
Widest net when you want to accept every notation.
Combine with isalpha for a "something meaningful" check.
ifnot (s.isnumeric() ors.isalpha()):
reject(s)
Explicit ASCII-only check
Restrict to ASCII digits by combining with .isascii().
ifs.isascii() ands.isdigit():
... # ASCII 0-9 only
Examples
1. Plain digits
"12345".isnumeric()
Returns
True
2. Fraction
"½".isnumeric()
Returns
True
3. Roman numeral
"Ⅳ".isnumeric()
Returns
True
4. Superscript
"²".isnumeric()
Returns
True
5. Arabic-Indic
"٥٦٧".isnumeric()
Returns
True
6. Decimal fails
"3.14".isnumeric()
Returns
False # the dot
7. Negative fails
"-42".isnumeric()
Returns
False # the minus
8. Empty is False
"".isnumeric()
Returns
False
Pitfalls
1. isnumeric does NOT mean "can be converted to a number"
The most common misconception. isnumeric accepts fractions and Roman numerals but rejects decimals and signs. int("3.14") raises; float("½") also raises. isnumeric is about Unicode categorization, not parseability.
2. isdigit vs isnumeric vs isdecimal — three widths
isdecimal is narrowest (only decimal digits like 0-9). isdigit adds superscripts and a few more. isnumeric is widest — fractions, Roman numerals, and every Unicode numeric character.
Wrong tool
"½".isdigit()
False
Right width
"½".isnumeric()
True
3. Empty string returns False
Same rule as the rest of the is* family — empty is False by convention.
Wrong expectation
"".isnumeric()
False
Guard first
sands.isnumeric()
covers the empty case
4. Signs and separators are NOT numeric characters
The minus sign, plus sign, decimal point, thousands separator, and currency symbols all count as punctuation or symbols — not numeric. Even "-42", which looks numeric to a human, returns False.
Sign rejected
"-42".isnumeric()
False
Strip sign first
s.lstrip("-+").isnumeric()
True on "-42"
When to use
Use it
Accepting a wide range of Unicode number-shaped strings
Filtering tokens that consist entirely of numeric characters
Three widths of "numeric character". isdecimal is narrowest — only characters that could be part of a base-10 integer literal. isdigit adds superscripts and a few decimal-like forms. isnumeric is widest — fractions, Roman numerals, and every Unicode-classified numeric character.
History
1.0
isnumeric() has been part of str since Python 1.0.
3.0
Full Unicode support — the widest numeric-character classifier in the is* family.