Python String isnumeric() Method Syntax
Syntax: string.isnumeric()
Parameters: isnumeric() does not take any parameters
Returns :
- True – If all characters in the string are numeric characters.
- False – If the string contains 1 or more non-numeric characters.
Python String isnumeric() Method
The isnumeric() method is a built-in method in Python that belongs to the string class. It is used to determine whether the string consists of numeric characters or not. It returns a Boolean value. If all characters in the string are numeric and it is not empty, it returns “True” If all characters in the string are numeric characters, otherwise returns “False”.
Example: In this given string we will check string contains numeric characters or not.
Python3
string = "123456789" result = string.isnumeric() print (result) |
Output:
True