Isalpha() Method Of Str Class

Method Name:

isalpha

 

Method Signature:

isalpha()

 

Method Overview:

  • If a string object is solely composed of alphabets isalpha()returns True; Returns False otherwise.

 

  • If the string is empty returns False

 

Example:

stmt        = "Honorificabilitudinitatibus"

alphaCheck  = stmt.isalpha()

print("String has only alphabets:{}".format(alphaCheck))

 

stmt        = ""

alphaCheck  = stmt.isalpha()

print("isalpha() returned:{} for an empty string".format(alphaCheck))

 

stmt        = "1Two3Four"

alphaCheck  = stmt.isalpha()

print("String has only alphabets:{}".format(alphaCheck))

 

 

Output:

String has only alphabets:True

isalpha() returned:False for an empty string

String has only alphabets:False

 

 

 


Copyright 2019 © pythontic.com