check alphabet in python code example
Example 1: python alphabet
>>> import string
>>> string.ascii_lowercase
'abcdefghijklmnopqrstuvwxyz'
Example 2: is alphabet python
test = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
test.isalpha()
# This will return True if all chars in string are from a-z or A-Z and Flase in all other cases
Example 3: how to check if a string is composed only of alphabets in python
str1 = "hello world. welcome to python examples."
bool = str1.isalpha()
print('str1 contains only alphabets:', bool)
Example 4: isaplha in python
str = "abc"
print(str.isalpha())