Python String capitalize() is an inbuilt function that is used to make the first letter of the string capital. If the string already has its first letter capital, then the function capitalize() returns the original string only. In Python, the capitalize() method converts the first character of a string to the capital (uppercase) letter. If the string has its first character as capital, then it returns the original string.

Python String capitalize()

In Python string capitalize() method converts the first character of a string to the uppercase letter and lowercases all other characters if any.

Syntax

string.capitalize()

Here the string contains the string of which we want to capitalize the first letter.

#python #capitalize

Python String capitalize() Method Example
2.35 GEEK