Python String title() Method

Converts the first character of each word to uppercase and the rest of the characters in each word to lowercase, such that the resulting string conforms with the rules for a title.

Syntax

Python
string.title()

Example

Python
str = 'hello wORLD!'
print(str.title())

Output

Hello World!