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 into upper case. Python string title() method is used when you want to work with strings 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 returns a new string after conversion.

Syntax

The syntax of the string title function in Python.

string.title()

Return Value

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

Python string title example

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

Example 1:

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

The 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

Previous Article

Related Posts