Thursday, March 8, 2018

String isalpha() Method


String isalpha() Method in Python 3


The isalpha() method checks whether the string consists of alphabetic characters only.
Syntax
str.isalpha()


Return Value
This method returns true if all the characters in the string are alphabetic and there is at least one character, false otherwise.

Example
#!/usr/bin/python3
str = "this"; # No space & digit in this string
print (str.isalpha())
str = "this is string example....wow!!!"
print (str.isalpha())

Result
True
False