Skip to content
String Methods

isdecimal()

Check for characters used as base-10 decimal digits.

str.isdecimal()

Check for characters used as base-10 decimal digits.

Returns

True when the string is non-empty and all characters are decimal digits; otherwise False.

Try it

Run it and change it
text = "123"
print(text.isdecimal())

Worth knowing

  • isdecimal() is the narrowest digit check. isdigit() also accepts some digit characters such as superscripts, and isnumeric() accepts still more numeric characters.

Related entries