More Example on String title() Method
Here are some more examples on string title() method, for better understanding:
Example 1: Convert string to title
Python3
print ( "geeks_for_geeks" .title()) |
Output:
Geeks_For_Geeks
Example 2: Basic usages of String title() Method
Python3
# conversion from mixed case str1 = 'geeKs foR geEks' print (str1, 'converted to using title():' , str1.title()) # conversion from all lower case str4 = 'geeks for geeks' .title() print (str4, 'converted to using title():' , str4.title()) # conversion from all UPPER CASE str5 = 'WE ARE 1' .title() print (str5, 'converted to using title():' , str5.title()) |
Output:
geeKs foR geEks converted to using title(): Geeks For Geeks
Geeks For Geeks converted to using title(): Geeks For Geeks
We Are 1 converted to using title(): We Are 1
Python String Title method
Python String title() method returns a new string after converting the first letter of every word to uppercase(capital) and keeping the rest of the letters lowercase.
Example: Make string title case
Python3
print ( "usE stRing title Method" .title()) |
Output
Use String Title Method