Python String isdigit() Method Tutorial

In this section, we will learn what String isdigit() method is and how to use it in Python.

What is String isdigit() Method in Python?

The Python string isdigit() method is used to see if the entire characters of the target string value are digits.

Python String isdigit() Method Syntax:

string.isdigit()

String isdigit() Method Parameter

The method does not take an argument.

String isdigit() Method Return Value

The return value of this method is of type boolean and will be True if the entire characters of the target string are digits. Otherwise, even if one character of the string is not digit, the value False will return instead.

Example: using python string isdigit() method

s1= "Think 123"

s2 = "12342"

result = s1.isdigit()

result2 = s2.isdigit()

print(result)

print(result2)

Output:

False

True
Facebook
Twitter
Pinterest
LinkedIn

Top Technologies