In this section, we will learn what String istitle() method is and how to use it in Python.
What is String istitle() Method in Python?
The Python string istitle() method is used to check a string value to see if each word’s first letter starts with a capital letter and the rest of letters of that word are in lowercase or not.
Basically, this method checks a string value to see if each word in it is following the rules of the title word or not!
Python String istitle() Method Syntax:
string.istitle()
String istitle() Method Parameter
The method does not take an argument.
String istitle() Method Return Value
The return value of this method is of type boolean.
The value True will return if each word in that string is in title form. Otherwise the value False will return instead.
Example: using python string istitle() method
s1= "THIS IS A SENTENCE" s2 = "This Is A Sentence" s3 = "This Is 122" print(s1.istitle()) print(s2.istitle()) print(s3.istitle())
Output:
False True True