Python3 isdecimal() Method
Description
The isdecimal() method checks whether a string contains only decimal characters.
Syntax
Syntax of the isdecimal() method:
str.isdecimal()
Parameters
- None
Return Value
- True - If all characters in the string are decimal characters.
- False - At least one character is not a decimal character.
Example
The following example shows how to use the isdecimal() function:
Example
#!/usr/bin/python3
str
=
"runoob2016"
(
str
.
isdecimal
(
)
)
str
=
"23443434"
(
str
.
isdecimal
(
)
)
The output of the above example is:
False
True
Python3 Strings