Python String isdecimal() Method

Returns True if all characters in the string are decimals, which includes decimal characters in various languages and Unicode characters that are digits.

Syntax

Python
string.isdecimal()

Example

Python
str1 = '0123456789' # Decimals
str2 = '??????????'    # Tibetan decimals 0-9
str3 = '<sup>038</sup>'         # superscript digits
str4 = '?'          # the fraction character 1/8th
str5 = '0A'         # A string with an alphabetic character

print(str1.isdecimal())
print(str2.isdecimal())
print(str3.isdecimal())
print(str4.isdecimal())
print(str5.isdecimal())

Output

True
True
False
False
False

Notes

If a character is decimal, the character will also be considered a digit and a numeric. See isdigit() and isnumeric().