Python String isdecimal() Method
You are Here:
Python String isdecimal()
The isdecimal()
method checks whether all the characters of the string are decimal (0-9) or not.
This method is used on unicode objects.
Note: This method does not allow alphabets and special characters.
Example
Python Compiler
str1 = "python"
str2 = "123"
str3 = "\u0031" # unicode for 1
str4 = "\u0045" # unicode for E
print(str1.isdecimal()) # False
print(str2.isdecimal()) # True
print(str3.isdecimal()) # True
print(str4.isdecimal()) # False
Output
False
True
True
False
Syntax
txt.isdecimal()
Parameter Values
It does not take any parameter.
Return Value
Value | Explanation |
---|---|
True | If the characters of the string contains only decimal. |
False | If the characters of the string contains other than decimal. |
Reminder
Hi Developers, we almost covered 90% of String functions and Interview Question on Python with examples for quick and easy learning.
We are working to cover every Single Concept in Python.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.