Site icon i2tutorials

Isnumeric() method in Python String Module

Isnumeric() method in Python String Module


Isnumeric method in string module returns the output as TRUE if the string only numeric values, or else it return the output as FALSE.


Syntax:

str.isnumeric()


Example-1:

text = "45875"
x = text.isnumeric()
print(x)


Output:


Example-2:

Let us verify by passing a decimal value.

text = "478.5"
x = text.isnumeric()
print(x)


Output:

Exit mobile version