PythonStringisdigit
center

isdigitString

isalpha

Returns True if all characters are digits.

Syntax

str.isdigit()

Example

Enter values below to update the example in real time.

print
isdigit
print("123".isdigit())    # True
print("12.3".isdigit())   # False
print("abc".isdigit())    # False