.isalpha()
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:
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Python on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Course
Learn Python 3
Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.With CertificateBeginner Friendly23 hours