PyDocs

Nav

Python Runtime Services

str.isdigit

builtins

method of str
  • str.isdigit()
Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are
digits and there is at least one character in the string.
1 Example
>>> '0123456789'.isdigit()
True
>>> '٠١٢٣٤٥٦٧٨٩'.isdigit()  # Arabic-Indic digits zero to nine
True
>>> '⅕'.isdigit()  # Vulgar fraction one fifth
False
>>> '²'.isdecimal(), '²'.isdigit(),  '²'.isnumeric()
(False, True, True)
from the Python docs
See Also
No see-alsos for builtins/str.isdigit
0 Notes
No notes for str.isdigit