Python String isnumeric() Method
Example
Check if all the characters in the text are numeric:
txt =
"565543"
x = txt.isnumeric()
print(x)
Run example »
Definition and Usage
The isnumeric()
method returns True if all the
characters are numeric (0-9), otherwise False.
Exponents, like ² and ¾ are also considered to be numeric values.
Syntax
string.isnumeric()
Parameter Values
No parameters.
More Examples
Example
Check if the characters are numeric:
a = "\u0030" #unicode for 0
b = "\u00B2" #unicode for ²
c = "10km2"
print(a.isnumeric())
print(b.isnumeric())
print(c.isnumeric())
Run example »