Python String isalpha() Method

Last Updated:

Python String isalpha()

The isalpha() method checks whether all the characters of the string are Alphabets (a-z or A-Z) or not.

Note: This method does not allow numbers and special characters.

Example

Python Compiler
str1 = "python" str2 = "123" str3 = "PyThOn" str4 = "python123" print(str1.isalpha()) # True print(str2.isalpha()) # False print(str3.isalpha()) # True print(str4.isalpha()) # False

Syntax

txt.isalpha()

Parameter Values

It does not take any parameter.

Return Value

ValueExplanation
True If the characters of the string contains only alphabets.
False If the characters of the string contains other than alphabets.

Share this Page

Meet the Author