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