Python String title()

Python String.title() is used to convert this string into a title. title() method returns a new string with the first character of each word in the original string converted to uppercase.

In this tutorial, we will learn the syntax and examples for title() method of String class.



The syntax to call title() method on string x in Python is



In the following program, we take a string 'sample title', and convert this string into title using title() method.

x = 'sample title'
result = x.title()
print('Original String : ', x)
print('Result String   : ', result)
Try Online


Original String :  sample title
Result String   :  Sample Title


In this Python Tutorial, we learned how to convert a string to title using title() method, with examples.