Python - String isalpha() Method


Advertisements

The string 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.

Example:

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

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

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

Output

False   

True    

String Methods
Advertisements