Python String - isalpha() method

isalpha() is a built-in method used in string manipulations in python.

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".

Further Read:

Interview Preparation: