Python String isalpha() Method

The isalpha() method is a string method that returns True if all the characters in the string are alphabetic letters (a-z).

For example:

name = "Alice"
print(name.isalpha())

# prints True

The method returns False if the string contains any non-alphabetic characters, such as spaces, numbers, punctuation marks, symbols, etc.

For example:


name = "Alice 123"
print(name.isalpha())

# prints False

If you have any questions about this code, you can drop a line in comment.

Comments

Popular posts from this blog

Python float() Built in Function

Python String encode() Method

Python getattr() Built in Function

Python Use Get Method Over Square Brackets

Python exec() Built in Function