Tutorial Study Image

Python title()

The title() function in python helps to return a new string in which the first character of each word should be a capital letter and the remaining will be small letters like a header or title.


title() Parameters:

The title() method doesn't take any parameters. The conversion will perform only if the first character of the word is a letter. If the word starts with a number or a symbol the first letter after this will be capitalized.

title() Return Value

The return value will be a copy of the original string. The title() capitalizes the first character after apostrophes also.

Input Return Value
string title cased string

Examples of title() method in Python

Example 1: How title() works in Python?

string1 = 'my name is jhon 25.'

string2 = '45 nm44 *67 find'


My Name Is Jhon 25
45 Nm44 *67 Find

Example 2: How title() with apostrophes?

string = "she's a docter, isn't she?"


She'S A Docter, Isn'T She?