Python 3 reference · String Methods

Python String isalpha() Method

Return True if every character is a letter (in any alphabet) and the string isn't empty. Spaces and digits return False.

Python 3 Since 3.0

Syntax

str.isalpha()

Return value

True or False.

Examples

Which strings are letters only?Try it yourself
for s in ["Python", "Py3", "naïve", "two words", ""]:
    print(repr(s), s.isalpha())

Output

'Python' True
'Py3' False
'naïve' True
'two words' False
'' False
Check each wordTry it yourself
name = "Mary Jane"
print(all(part.isalpha() for part in name.split()))

Output

True

Version history

VersionChange
Python 3.0Added