Python 3 - String capitalize() Method


Advertisements

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

Syntax

Following is the syntax for 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 we run above program, it produces the following result −

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