# Python isdigit

The Python isdigit string function is used to check whether the character is a digit or not. In this section, we discuss how to write or use this string isdigit Function with an example, and the syntax is

`String_Value.isdigit()`

It returns a Boolean value as an output.

• If the String_Value is a valid digit, then it returns TRUE
• If the String_Value is not, then it returns FALSE.

## Python Program to Check for Digit using isdigit function

The following set of examples helps you understand the isdigit function and how to use it on the float, positive and negative numbers.

First, we declared the string variable Str1 and assigned corresponding value (Integer Value) using the following statement. Next, we used the it to check whether the string is a digit or not.

As you can see from the below code, 123456789 is a valid digit. So, the String method returns TRUE.

The following Python statement checks whether the Empty space is a valid digit or not.

Next, we are using the string isdigit function on the following group of words.

```Str1 = '123456789';
print('First Output of a method is = ', Str1.isdigit())

Str2 = '     ';
print('Output of a method For Empty Space is = ', Str2.isdigit())

# Performing function directly
Str3 = 'Find Tutorial at Tutorial Gateway'.isdigit()
print('Second Output  = ', Str3)

# Performing on both Digits and Alphabets
Str5 = '123456789a'.isdigit()
print('Third Output  = ', Str5)

# Performing on Float values
Str6 = '1234.67'.isdigit()
print('Fourth Output  = ', Str6)

# Performing on Negative Values
Str7 = '-1234'.isdigit()
print('Fifth Output  = ', Str7)```