# 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 in Python Programming with example.

## Python isdigit Syntax

The syntax of is digit in Python function is

`String_Value.isdigit()`

The isdigit string function 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 a valid digit, then the string isdigit function returns FALSE

### Program to Check for Digit using Python isdigit function

The following set of examples helps you understand the string isdigit function and how to use it.

```# Python isdigit Method Example

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

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

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

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

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

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

First, we declared the String variable Str1 and assigned corresponding value (Integer Value) using the following statement. Next, we used the isdigit function to check whether the string is a digit or not. As you can see from the below code, it is a valid digit. So, the isdigit String function returns TRUE.

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

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

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

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

```Str3 = 'Find Tutorial at Tutorial Gateway'.isdigit()
print('Second Output of a isdigit() method is = ', Str3)```