The python string isdigit() method is one of the inbuilt functions of string. The isdigit() function is used to check whether a string consists of only digits(0-9).
The Python isdigit() method returns true or false. It returns True if the string consists of digits only otherwise it returns False.

Python String isdigit() method Syntax :
string.isdigit()
String isdigit() method examples in Python
Below are the different types of examples of the isdigit() method.
Example 1:
str = "abcd1"
print(str.isdigit())
Output :
False
Example 2:
str = "1234"
print(str.isdigit())
Output :
It returns true because the string contains only digits.
True
Example 3:
str = "1234 "
print(str.isdigit())
Output :
It returns false because the string also contains space at the end with digits.
False
Example 4:
str = "1234&*"
print(str.isdigit())
Output :
It returns false because the string also contains a special symbol at the end with digits.
False