The isalpha Method in Python: Checking if a String Contains Only Letters

This method returns True or False, indicating whether a string contains only letters.

isalpha()

Returns True if the string has at least one character and all characters are letters; otherwise, it returns False.

''.isalpha()  # False
'  '.isalpha()  # False
'!@#'.isalpha()  # False
'abc'.isalpha()  # True
'123'.isalpha()  # False
'abc123'.isalpha()  # False