Python String isdecimal() Method

Last Updated:

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.


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



Parameter Values

It does not take any parameter.

Return Value

True If the characters of the string contains only decimal.
False If the characters of the string contains other than decimal.

Share this Page

Meet the Author