Python string | isdecimal()
isdecimal()-It is a function in Python that returns true if all characters in a string are decimal. If all characters are not decimal then it returns false.
Syntax:
string_name.isdecimal()
Here string_name is the string whose characters are to be checked
Parameters:This method does not takes any parameters .
Returns Value:
True – all characters are decimal
False – one or more then one character is not decimal.
Below is the Python3 implementation of isdecimal() method:
# Python3 program to demonstrate the use # of isdecimal() s = "12345"print(s.isdecimal()) # contains alphabets s = "12geeks34"print(s.isdecimal()) # contains numbers and spaces s = "12 34"print(s.isdecimal()) |
Output:
True False False
Recommended Posts:
- numpy string operations | isdecimal() function
- Python | Pandas Series.str.isdecimal()
- Python | Check if given string can be formed by concatenating string elements of list
- String slicing in Python to check if a string can become empty by recursive deletion
- Python | Check if string ends with any string in given list
- Python | Sorting string using order defined by another string
- Python | Check if a given string is binary string or not
- String slicing in Python to rotate a string
- Python String | max()
- Python | Add one string to another
- Python String
- Python String | min()
- Python String | istitle()
- string center() in python
- String rindex() in python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



