Test for Alphabetical Letters in Character String Using Python (Example Code)
In this Python programming tutorial you’ll learn how to test for letters from the alphabet in a string.
Introducing Example Data
x = "abcd1234" # Create character string with letters |
x = "abcd1234" # Create character string with letters
Example: Check If String Contains Alphabetical Letters Using isalpha() Function
print(any(c.isalpha() for c in x)) # Test whether letters are contained in string # True |
print(any(c.isalpha() for c in x)) # Test whether letters are contained in string # True