Python string Method - title()

https://w‮tfigi.ww‬idea.com

The title() method is a built-in string method in Python that returns a copy of a string with the first character of each word in uppercase and the rest of the characters in lowercase.

The syntax for using title() method is as follows:

string.title()

Here, string is the original string.

The method returns a new string with the first character of each word in uppercase and the rest of the characters in lowercase.

Here's an example of using the title() method:

string = "hello, world!"
title_string = string.title()
print(title_string)

Output:

Hello, World!

In the example above, the title() method was used to convert the original string "hello, world!" to a new string with the first character of each word in uppercase and the rest of the characters in lowercase. The resulting string is stored in the variable title_string. Note that the first character of each word is converted to uppercase and the rest of the characters are converted to lowercase.