Python capitalize() Function Guide

The capitalize() method is a function in Python that is used for converting the first letter of a string to uppercase and the rest to lowercase. Its usage is as follows:

string.capitalize()

The string is the string that needs to be operated on. Here is an example:

text = "hello, world!"
result = text.capitalize()
print(result)

The output is “Hello, world!”

bannerAds