{"id":24538,"date":"2021-10-22T09:59:19","date_gmt":"2021-10-22T04:29:19","guid":{"rendered":"https:\/\/python-programs.com\/?p=24538"},"modified":"2021-11-05T19:05:55","modified_gmt":"2021-11-05T13:35:55","slug":"python-string-title-function-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-string-title-function-with-examples\/","title":{"rendered":"Python String title() Function with Examples"},"content":{"rendered":"

In the previous article, we have discussed Python String split() Method Examples<\/a>
\nPython String title() Function:<\/strong><\/p>\n

The title() method returns a string in which the first character of each word is capitalized. As in a header or a title.<\/p>\n

If the word contains a number or a symbol, the following letter will be converted to upper case.<\/p>\n

Syntax:<\/strong><\/p>\n

string.title()<\/pre>\n

Parameters:<\/strong> This function doesn’t have any parameters.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given first string =  \"hello this is btechgeeks\"\r\nGiven second string = \"10345 good morning 2a2a btechgeeks\"<\/pre>\n

Output:<\/strong><\/p>\n

The above given first string is : hello this is btechgeeks\r\nThe given first string after applying title() function:\r\nHello This Is Btechgeeks\r\nThe above given second string is : 10345 good morning 2a2a btechgeeks\r\nThe given second string after applying title() function:\r\n10345 Good Morning 2A2A Btechgeeks<\/pre>\n

Note:<\/strong><\/p>\n

It is worth noting that the first letter after a non-alphabet \r\nletter is converted to an upper case letter.<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given first string = \"welcome to Python-Programs\"\r\nGiven second string = \"HELLO ALL GOOD MORNING\"<\/pre>\n

Output:<\/strong><\/p>\n

The above given first string is : welcome to Python-Programs\r\nThe given first string after applying title() function:\r\nWelcome To Python-Programs\r\nThe above given second string is : HELLO ALL GOOD MORNING\r\nThe given second string after applying title() function:\r\nHello All Good Morning<\/pre>\n

Program for String title() Function in Python<\/h2>\n