isalpha() function in python by R4R Team

- isalpha() is a python in-build function which check the string contain only alphabet or not.
- if string contain only alphabet then it will return True otherwise it will return False.

Example

string is "123"
it will return False

string is "mytext123"
it will return False

string is "mytext"
it will return True



program-

s="my132"
print(s.isalpha())
s="mytext"
print(s.isalpha())
s="MYTEXT"
print(s.isalpha())
s="132my"
print(s.isalpha())
s="This is the string"
print(s.isalpha())
s="Thisisthestring"
print(s.isalpha())


output-

False
True
True
False
False
True


-In this program, we check the string contains only alphabet or not by the s.isalpha(), in case of string contain numbers and white space it will return False as shown in above program.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!