Chapters
Python114 chapters

ReferenceString methods

str.isdigit()

Whether every character is a digit. This is not a number check.

Signature

text.isdigit()

Returns

A bool, and False for an empty string.

Example

Python
print("123".isdigit())
print("-4".isdigit())
print("3.5".isdigit())
print("".isdigit())

Output

True
False
False
False

See also