Definition
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()
Parameters
No Parameters.
Examples:
myStr = "123456"
result = myStr.isnumeric()
print(result)
# other examples
c = "10km2"
d = "-1"
e = "1.5"
print(c.isnumeric())
print(d.isnumeric())
print(e.isnumeric())