Python string title() method
Capitalise the first letter of every word.
Syntax
str.title()
Handy for names and headings. It treats any non-letter as a word break, so "o'neil" becomes "O'Neil".
Parameters
None.
Return value
str
Example
Code
print("sita gurung".title()) print("the lord of the rings".title())
Output
Sita Gurung The Lord Of The Rings
Related
Learn it step by step in the free lesson Strings, with exercises that check your answers.