Signup/Sign In

Python String istitle()

In Python, the string method istitle() is used to check if a given string is a title or not.

  • This is an inbuilt function of string handling in python.

  • When this function is applied to a string; then in the case if given string's first character is in uppercase and rest all are in lowercase then this function returns true. If a string has multiple words, then all the words should have the first character as uppercase and rest of the characters in lowercase.

  • The istitle() method ignores symbols and numbers present in a given string.

  • Those strings having the first letter in uppercase and rest other in lowercase for all the words in it is said to be in titlecased. Thus if a string is in titlecased then this method returns true otherwise returns false.

For example, "I Am John Wick" is titlecased but "I am John Wick" is not titlecased as "am" doesn't have the first character, i.e. A as capital.

Python String istitle(): Syntax

Below we have a basic syntax of the istitle() method in Python:


Note: In the above syntax, str indicates the variable whose value is needed to be checked.

Python String istitle(): Parameters

As from the syntax, it is clear that this method does not take any parameters:

  • If any parameter is passed into this then this will raise an error.

Python String istitle(): Returned Values

This method returns true if the first letter of a string is in uppercase while rest are in lowercase which means if a string is in titlecased otherwise returns false.

Python String istitle(): Basic Example

Below we have an example to show the working of the python string istitle() method:

str="This is the best place to learn coding"

str2= "I Am A John Cena Fan"


The output for the above will be:


Python String istitle(): Simple Program

Let us see a given program where we will check if the given two strings are in titlecased or not and will see the output for the same:

a = "I Am The Queen"
b = "I Love Python"
if(a.istitle() and b.istitle()):

The above code gives the output as follows:


Time for a Live Example!

Let us see a live example where we run this method in different ways:


In this tutorial, we learned how to check if any given string is in titlecased or not using the istitle() method of strings in Python. This method ignores numbers and symbols.