Home >>Python String Methods >Python String istitle() Method

Python String istitle() Method

Python String istitle() Method

Python String istitle() Method returns true if all the words in the string is a titlecased (first character in each word uppercase and remaining all characters is Lowercase alphabets) otherwise it returns false. Note symbols and numbers are ignored.

Syntax:
string.istitle()
Here is an example of Python String istitle() Method:

title = "Hello, Welcome To Phptpoint!"
x = title.istitle()
print(x)

Output:
True
Example 2:

str = "abc cde efg"  
if str.istitle() == True:  
    print("this is title case")  
else:  
    print("this is not in title case")  
str = "Abc Cde Efg"  
if str.istitle() == True:  
    print("this is title case")  
else:  
    print("this is not in title case")  
str = "1bc 2de 3fg"  
if str.istitle() == True:  
    print("this is title case")  
else:  
    print("this is not in title case") 

Output:
this is not in title case
this is title case
this is not in title case

No Sidebar ads