Skip to content
Related Articles

Related Articles

string capitalize() in Python

View Discussion
Improve Article
Save Article
Like Article
  • Difficulty Level : Medium
  • Last Updated : 02 Dec, 2020

In Python, the capitalize() method returns a copy of the original string and converts the first character of the string to a capital (uppercase) letter while making all other characters in the string lowercase letters.



string_name: It is the name of string of
             whose first character we want
             to capitalize.

Parameter: The capitalize() function does not takes any parameter. 
Return value: The capitalize() function returns a string with the first character in the capital. 
Below is the python program to illustrate capitalize() function: 


# Python program to demonstrate the
# use of capitalize() function
# capitalize() first letter of string
# and make other letters lowercase
name = "geeks FOR geeks"
# demonstration of individual words
# capitalization to generate camel case
name1 = "geeks"
name2 = "for"
name3 = "geeks"
print(name1.capitalize() + name2.capitalize()
                         + name3.capitalize())


Geeks for geeks


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!