Python isalpha() method
Description
The Python isalpha() method checks whether a string consists only of letters.
Syntax
Syntax of the isalpha() method:
str.isalpha()
Parameters
- none.
Return Value
Returns True if the string has at least one character and all characters are letters, otherwise returns False.
Example
The following example demonstrates the isalpha() method:
Example
#!/usr/bin/python
coding=utf-8
str
=
"runoob"
;
str
.
isalpha
(
)
;
str
=
"runoobRunoob Tutorial"
;
str
.
isalpha
(
)
;
str
=
"this is string example....wow!!!"
;
str
.
isalpha
(
)
;
The output of the above example is:
True
False
False
Python Strings