python string.isalpha() method
python string isalpha() method checks whether a string consists of only alphabetic characters.
Syntax:
str.isalpha()
Parameters:
The following are detailed parameters:
Not applicable
Return value :
It returns true if all characters in the string are letters and there is at least one character, otherwise it returns false.
For example:
#!/usr/bin/python str = "this"; # No space & digit in this string print str.isalpha(); str = "this is string example....wow!!!"; print str.isalpha();
This will output the following results:
True False
[Related recommendations]
2. isalpha in Python 2.7 does not support unicode
The above is the detailed content of How to check whether a string consists of letters in python: string.isalpha(). For more information, please follow other related articles on the PHP Chinese website!