str.isalpha()
str.isalpha() Returns:
bool · Added in v3.x · Updated March 13, 2026 · String Methods string validation alphabetic
The .isalpha() method checks whether all characters in a string are alphabetic letters and the string contains at least one character. It returns a boolean value, making it useful for validating user input, checking string types, and filtering data based on character composition.
This method is part of Python’s suite of string classification methods. Unlike .isdigit() which only accepts numbers, or .isalnum() which accepts both letters and numbers, .isalpha() is stricter—it only returns True for pure alphabetic strings.
Syntax
str.isalpha()
Parameters
This method takes no parameters.
Examples
Basic usage
text = "Hello"
print(text.isalpha())
# True
with_space = "Hello World"
print(with_space.isalpha())
# False (space is not alphabetic)
with_number = "Hello123"
print(with_number.isalpha())
# False (numbers are not alphabetic)
Empty strings return False
empty = ""
print(empty.isalpha())
# False
# This is important for validation logic
# An empty string has no alphabetic characters
Special characters fail the check
with_underscore = "hello_world"
print(with_underscore.isalpha())
# False
with_hyphen = "hello-world"
print(with_hyphen.isalpha())
# False
with_punctuation = "Hello!"
print(with_punctuation.isalpha())
# False
Common Patterns
Validating names
def is_valid_name(name):
"""Check if name contains only alphabetic characters."""
if not name:
return False
return name.isalpha()
print(is_valid_name("John"))
# True
print(is_valid_name("John Doe"))
# False (space not allowed)
print(is_valid_name("Maria"))
# True
print(is_valid_name(""))
# False
Processing input lists
words = ["hello", "world123", "test!", "python", "code2"]
# Filter to only alphabetic words
alphabetic = [w for w in words if w.isalpha()]
print(alphabetic)
# ['hello', 'python']
Combining with other checks
def is_proper_noun(word):
"""Check if word is alphabetic and starts with uppercase."""
if not word or not word.isalpha():
return False
return word[0].isupper()
print(is_proper_noun("London"))
# True
print(is_proper_noun("london"))
# False
print(is_proper_noun("London2"))
# False
Unicode Support
Python 3 treats Unicode letters as alphabetic. This includes characters from many writing systems beyond the basic Latin alphabet:
# Latin letters work as expected
print("Python".isalpha())
# True
# Greek letters are also alphabetic
greek = "Πύθων"
print(greek.isalpha())
# True
# Cyrillic letters work too
cyrillic = "Питон"
print(cyrillic.isalpha())
# True
# Chinese characters are considered alphabetic in Python
chinese = "Python语言"
print(chinese.isalpha())
# False (mixed scripts)
# Emoji are not alphabetic
emoji = "👋"
print(emoji.isalpha())
# False
Behavior Notes
- Returns
Falsefor empty strings—the string must contain at least one character - Returns
Truefor strings containing only alphabetic Unicode characters - Does not check for spaces, numbers, punctuation, or mixed character types
- Unicode category “Lm”, “Lt”, “Lu”, “Ll”, “Lo”, or “Lt” characters are considered alphabetic