Python Tutorial Python Advanced Python References Python Libraries

Python String - istitle() Method



The Python istitle() method is used to check whether all characters of the string are in title format or not. It returns true when all characters of the string are in title format, else returns false. A title format consists of first character of each word in uppercase and rest in lower case. Any symbol, space, or number in the string is ignored while applying this method. Only alphabet are checked.

Syntax

string.istitle()

Parameters

No parameter is required.

Return Value

Returns True if the given string is in title format, else returns False.

Example:

In the example below, istitle() method checks whether all characters of the given string are in title format or not.

MyString = "Hello World!"
print(MyString.istitle())

MyString = "Hello world"
print(MyString.istitle())

The output of the above code will be:

True    
False  

Example:

When the string contains any symbol, space, or number, it is ignored by the method. It only checks alphabet. Consider the following example.

MyString = "@Hello World"
print(MyString.istitle())

The output of the above code will be:

True  

❮ Python String Methods