Python isalpha method is useful to check whether the given string has at least one character and whether the character is either an alphabet or not.
In this section, we discuss how to write Python string isalpha Function with an example, and the syntax is
String_Value.isalpha()
Python Program to Check for an Alphabet
The following set of examples helps you understand the function. Please refer to the String and Methods articles to understand them in Python.
Str1 = 'TutorialGateway'; print('First Output of a method is = ', Str1.isalpha()) # Performing on Empty Space Str2 = ' '; print('Second Output of For Empty Space is = ', Str2.isalpha()) # Performing directly on Alphabets Str3 = 'Learn Tutorial at Tutorial Gateway'.isalpha() print('Third Output is = ', Str3) # Performing on both Digits and Alphabets Str4 = '1239abcd'.isalpha() print('Fourth Output of is = ', Str4) # Performing on Special Characters Str5 = '@@@!!!!'.isalpha() print('Fifth Output of a is = ', Str5)
