Python String Title method

Python Methods and Functions | String Variables

Syntax :

  str.Title ()   parameters:  str is a valid string which we need to convert ...  return:  This function returns a string which has first letter in each word is uppercase and all remaining letters are lowercase. 

# Python Title () Method Example

 

str1 = 'geeKs foR geEks'

str2 = str1.title ()

print 'First Output after Title () method is =' , str2

 
# watch original line

print 'Converted String is =' , str1.title ()

print 'Original String is =' , str1

  
# Execute title () function directly

str3 = 'ASIPU pawan kuMAr' . title ()

print 'Second Output after Title () method is =' , str3

 

str4 = 'stutya kUMari sHAW' . title ()

print 'Third Output after Title () method is =' , str4

 

str5 = '6041' . title ()

print 'Fourth Ou tput after Title () method is = ' , str5

Output:

 First Output after Title () method is = Geeks For Geeks Converted String is = Geeks For Geeks Original String is = geeKs foR geEks Second Output after Title () method is = Asipu Pawan Kumar Third Output after Title () method is = Stutya Kumari Shaw Fourth Output after Title () method is = 6041 




Tutorials