Python Function Reference

str.isalpha

Check that the string is not empty and contains only letters.

Python 3.13
str.isalpha()

Return value

True or False; False for an empty string.

Examples

Letters only

Python 3.13
print('Python'.isalpha())
True

String with a space and a digit

Python 3.13
print('Python 3'.isalpha())
False

Details

Spaces, digits and punctuation are not letters, while letters of any alphabet, including Cyrillic, are.

See also

Where to learn