Python Tutorial Python Advanced Python References Python Libraries

Python String - isalpha() Method



The Python isalpha() method is used to check whether all characters of the string are alphabets or not. It returns true when all characters of the string is alphabets, else returns false. Alphabet characters belongs to letters A - Z (both uppercase and lowercase).

Syntax

string.isalpha()

Parameters

No parameter is required.

Return Value

Returns True if all characters of the specified string are alphabet, else returns False.

Example:

In the example below, isalpha() method is used to check whether all characters of the string are alphabets or not.

MyString = "Hello World!"
print(MyString.isalpha())

MyString = "HelloWorld"
print(MyString.isalpha())

The output of the above code will be:

False   
True    

❮ Python String Methods