Python String Title() Method Example

Python String title() is an inbuilt string handling function that returns a string in which the first letter of the words present in the string is uppercase, and all the other letters of the word are lowercase. If the string contains symbols and numbers, then the 1st number after it is converted to uppercase. We also call the words that have the first letter as uppercase and all other letters as lowercase title cased.

Python String title()

The title() function in python is used to convert the first character in each word to an uppercase and remaining characters to Lowercase in the string and returns a new string.



Here, the string is variable that is converted to be title cased.



The title() method doesn’t take any parameter and throws an error if any parameter is passed. It is used with a string using a dot operator, and the output string is shown.

Return Value

The method returns a string in which the characters of the words are title cased.

Example programs on the title() method


Write a program to show the working of the title() method.


h1 = "Hello"
h2 = "How are you"
h3 = "I am HackTheStuff"
h4 = "I love Python"

print("Original string: ", h1)
print("title(): ", h1.title(), "\n")
print("Original string: ", h2)
print("title(): ", h2.title(), "\n")
print("Original string: ", h3)
print("title(): ", h3.title(), "\n")
print("Original string: ", h4)
print("title(): ", h4.title(), "\n")


➜  pyt python3
Original string:  Hello
title():  Hello

Original string:  How are you
title():  How are you

Original string:  I am HackTheStuff
title():  I am HackTheStuff

Original string:  I love Python
title():  I love Python

➜  pyt

You can check I hope you will like this article. Also please follow us on Twitter and Like our Facebook page for updates.