Javatpoint Logo
Javatpoint Logo

Python String capitalize() Method

Python capitalize() method converts first character of the string into uppercase without altering the whole string. It changes the first character only and skips rest of the string unchanged.



No parameter is required.

Return Type

It returns a modified string.

Python String Capitalize() Method Example 1


Old value: javatpoint
New value: Javatpoint

Python String Capitalize() Method Example 2

What if first character already exist in uppercase.


Old value: Javatpoint	
New value: Javatpoint

It returns the same string without any alteration.

Python String Capitalize() Method Example 3

What if first character is a digit or non-alphabet character? This method does not alter character if it is other than a string character.


Old value: #javatpoint
New value: #javatpoint
Old value: 1-javatpoint
New value: 1-javatpoint

Next TopicPython Strings

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA