Python String Title method

  220 views   7 months ago Python

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.

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]