Python 3 – String capitalize() Method

Python 3 – String capitalize() Method

It returns a copy of the string with only the first character capitalized.

Syntax

Below is the syntax of the capitalize() method –

str.capitalize()

Parameters

NA

Return Value

String

Example

#!/usr/bin/python3

str = "this is string example....wow!!!"
print ("str.capitalize() : ", str.capitalize())

Result

When running the above program, it produces the following result −

str.capitalize() : This is string example....wow!!!

Leave a Reply

Your email address will not be published. Required fields are marked *