Python isalpha is one of the Python String Method which is used to check whether the given string has at least one character, and the character is either an alphabet or not. In this article we will show you, How to write isalpha Function in Python Programming with example.
isalpha Syntax in Python
The basic syntax of the isalpha in Python is as shown below:
- String_Value: Please select a valid String literal.
Program to Check for an alphabet using Python isalpha
The following set of examples will help you understand the Python string isalpha function
# Python isalpha Method Example Str1 = 'TutorialGateway'; print('First Output of a isalpha() method is = ', Str1.isalpha()) # Performing isalpha() function on Empty Space Str2 = ' '; print('Second Output of a isalpha() method For Empty Space is = ', Str2.isalpha()) # Performing isalpha() function directly on Alphabets Str3 = 'Python Tutorial at Tutorial Gateway'.isalpha() print('Third Output of a isalpha() method is = ', Str3) # Performing isalpha() on both Digits and Alphabets Str4 = '1239abcd'.isalpha() print('Fourth Output of a isalpha() method is = ', Str4) # Performing isalpha() on Special Characters Str5 = '@@@!!!!'.isalpha() print('Fifth Output of a isalpha() method is = ', Str5)
Thank you for Visiting Our Blog