isalpha() is a built-in method used in string manipulations in python.
isalpha() method does not take any parameters.
For ex: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
Else it returns "False"
Output
Note: In last example we can see that space between the string 'Red Tomato' is also taken into consideration and method return "False".
Syntax
string.isalpha()
isalpha() method does not take any parameters.
Returns
isalpha() method will return "True" if all the characters in the passed string are alphabets and there is at least one character in the string.For ex: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
Else it returns "False"
Let's take a look at a few examples to understand further.
# Python code for using isalpha()
# checking for alphabets
string = 'Apple'
print(string.isalpha())
string = 'Apple101'
print(string.isalpha())
string = 'Red Tomato'
print( string.isalpha())
Output
True
False
False
Note: In last example we can see that space between the string 'Red Tomato' is also taken into consideration and method return "False".