Python‎ > ‎string constants‎ > ‎

string.capwords

http://www.adilwaseem.com/

Introduction
Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using
join.

Syntax
capwords(s [,sep]) -> string

Parameters
s=string

Examples
The string value is capitalized.
 >>> string.capwords("adil waseem")
'Adil Waseem'
>>> >>> 
>>> string.capwords("python research Centre")
'Python Research Centre'
>>>

capitalizing input(str)
The method str.capitalize through input() returns with capitalizing the string value.
 name1=input("Enter your name: ")
if name1.lower():
    print("Your name is: ", name1.capitalize())
>>> 
Enter your name: adil
Your name is: Adil
>>> 

Comments