.isalpha()

rclarkeweb's avatar
Published Oct 9, 2023
Contribute to Docs

The .isalpha() string method checks if all of the characters in a string are letters of the alphabet (a-z). The letters can be lowercase or uppercase. If the string only contains letters of the alphabet it returns True, otherwise it returns False. Whitespace, numbers, and symbols are not considered to be part of the alphabet.

Syntax

my_string.isalpha()

The .isalpha() method doesn’t have any parameters.

Example

The following example uses .isalpha() to check str:

str = "Coding123"
print(str.isalpha())

This example will output:

False

Codebyte Example

The following code is runnable and uses .isalpha() to check several strings:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn Python on Codecademy