0
Hey guys.I wonder if there is any "special word" for all the letters (not numbers) which I can use so I dont to have a huge list
3 odpowiedzi
+ 1
Try this:
name = "my name is sapphire"
name_2 = "my name is 123abc"
name_3 = "Sapphire"
print(name.isalpha())
print(name_2.isalpha())
print(name_3.isalpha ())
#Output:
False
False
True
The isalpha() method checks to see if the string contains at least 1 or more letters in the string. True if all are letters, False if anything else is there like whitespace or numbers.
+ 6
alphabet? 😋
+ 1
import string
print(string.ascii_letters)