Python isalpha

Python isalpha method is used to check whether the given string has at least one character, and the character is either an alphabet or not.

In this section, we discuss how to write string isalpha Function with example. The syntax of the isalpha in Python Programming is


Python Program to Check for an alphabet using isalpha

The following set of examples help you understand the function. Please refer to the String and String Methods articles to understand the strings in Python.

Str1 = 'TutorialGateway';
print('First Output of a isalpha() method is = ', Str1.isalpha())

# Performing on Empty Space
Str2 = '     ';
print('Second Output of a isalpha() method For Empty Space is = ', Str2.isalpha())

# Performing directly on Alphabets
Str3 = 'Python Tutorial at Tutorial Gateway'.isalpha()
print('Third Output of a isalpha() method is = ', Str3)

# Performing on both Digits and Alphabets
Str4 = '1239abcd'.isalpha()
print('Fourth Output of a isalpha() method is = ', Str4)

# Performing on Special Characters
Str5 = '@@@!!!!'.isalpha()
print('Fifth Output of a isalpha() method is = ', Str5)
Python isalpha function 1