The isdecimal() method checks if a string contains only decimal characters.
Example
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
str1 = '123-456-789'
str2 = '0123456789'
print (str1.isdecimal())
print (str2.isdecimal())
Output:
False
True
Syntax
str.isdecimal()
Parameters
The method doesn’t take any parameters.
Return Value
It returns true and false, depending on whether the string is decimal.