check if char is alphabet python code example
Example 1: 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)
//output will be False
Example 2: python check if character is letter
>>> 'A'.isalpha()
True
>>> '1'.isalpha()
False