Menu Close

Python String title() Method

Python string title

In this article, you will learn about the Python string title() method to convert each character of the word in upper case. Python string title() method is used when you want to work with string in python.

In the previous tutorial, we have seen the Python string swapcase function to convert lower case to upper case and vice versa.

Python string title() method

python string title function is used to convert each character of each word in upper case. It does not require any parameter and return a new string after conversion.

Syntax

The syntax of string title function in Python.

string.title()

Return Value

The title function in Python return new string with converted each character of each word in uppercase.

Python string title example

Here we will take some example to understand title function in python.

Example 1:

a = 'python'
result = a.title()
print(result)

Output will be:- Python

Example 2

a = 'programming funda is education site.'
for i in a.split():
    print(i.title())

Output

Programming
Funda
Is
Education
Site.

Conclusion

In this tutorial, You have learned the Python string title() method to convert each character of each word in the upper case.
Using the title function in python, you can convert each character of each word in upper case.

I hope this tutorial will help you. If you like this article, please share it with your friends who want to learn Python programming.

Other string methods

For more information:- Click Here

Python String rstrip() Method
Python String splitlines() Method

Was this post helpful?

Related Posts

Leave a Reply

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