The isdigit() method in Python String checks whether the string consists of digits only. In Python strings, isdigit() method is again inbuilt and is utilized for handling strings. The isdigit() method in Python is supposed to return True when all characters found in the string are digits, else, It would return False.
Here is the syntax for isdigit() method:
This method returns true when all characters are digits in the string and there lies at least one character, otherwise, it returns false.
The following example shows the usage of isdigit() method.
str = "123456"; # Only digit in this string
str = "this is string example....wow!!!";
When we run above program, it produces following result
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.