What is the syntax to see if a string contains only letters?

<string name>.isalpha()
#examples
str = 'HELLOWORLD'
str2 = "HELLO WORLD"
str3 = 'abc123@'

print(str.isalpha())
print(str2.isalpha())
print(str3.isalpha())

#output
True
False
False

 

Advertisements