capitalize() Method Syntax

string_name.capitalize()

Parameter

The capitalize() function does not take any parameter. 

Return

The capitalize() function returns a string with the first character in the capital.

String capitalize() Method in Python

Python String 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.

Example

Python3




# initializing a string
name = "draco malfoy"
#using capitalize function
print(name.capitalize())


Output

Draco malfoy

Similar Reads

Definition of capitalize() Function

...

capitalize() Method Syntax

The capitalize() function in Python is used to capitalize the first letter of a string. It turns the rest of all letters to lowercase....

capitalize() Method Examples

string_name.capitalize()...