Python string title() method

Python String title() Method

Description

The title() method returns a copy of a string with the first letter of each word capitalized.

Syntax

The following is the syntax of the title() method −

var.title()

Parameters

None

Return Value

This method returns a copy of a string with the first letter of each word capitalized.

Example

The following example demonstrates the usage of the title() method.

var = "this is string example....wow!!!"
var1 = var.title()

print ("Original string:", var)
print ("Title format:", var1)

When you run this program, it will produce the following output −

Original string: this is string example....wow!!!
Title format: This Is String Example....Wow!!!

Leave a Reply

Your email address will not be published. Required fields are marked *