Function Details: capitalize
Description
Return a capitalized version of the string.
Extended Description
capitalize is a Python string method that converts strings first character to uppercase and remaining characters to lowercase. Works with upper and lower for case transformations. Similar to title but applies only to first character instead of each word. Useful for proper formatting of names, sentences, and text styling. Often used with strip for text cleanup and casefold for more aggressive Unicode case handling. Creates new string instance, preserving original data integrity. Essential for consistent text formatting in user interfaces and content management.
Read More about capitalize from Python Documentation
Function Signature
Module: builtins
Class: str
Parameters
Return
Returns a new string with the first character capitalized and the rest lowercased.
Return Type
str
Output
Explanation
This example demonstrates the basic usage of capitalize(). It capitalizes the first letter of the string.