Home >>Python String Methods >Python String isdecimal() Method

Python String isdecimal() Method

Python String isdecimal() Method

Python String isdecimal() Method in python returns Boolean either true or false if all characters in a string are decimals (0-9).

Syntax:
string.isdecimal()
Here is an example of Python String isdecimal() Method:

txt = "\u0055"
x = txt.isdecimal()
print(x)

Output:
False
Example 2:

str = "879" 
str3 = "@$#"
str2 = str.isdecimal()  
str4 = str3.isdecimal()  
print(str2)  
print(str4)  

Output:
True
False