Join Regular Classroom : Visit ClassroomTech

Python String – isalpha() method

It is a method in python string that checks if the given string has all the characters as alphabets only. It returns True if the condition satisfies else returns False.

Syntax:

string.isalpha()

Example 1:

s = “CodeWindow
x = s.isalpha()
print(x)

Output:

True

Explanation:

Here all the characters in the string are alphabets. Hence returned True.

Example 2:

s = “CodeWindow123
x = s.isalpha()
print(x)

Output:

False

Explanation:

Here the string contains numbers i.e.”123”. Hence it returned False.


Example 3:

s = “CodeWindow platform
x = s.isalpha()
print(x)

Output:

False

Explanation:

Here the string contains space in between i.e.” “. Hence it returned False.

You Missed
Also Checkout