Easy Tutorial
❮ Python Intro Python Linear Search ❯

Python3 capitalize() Method

Python3 Strings


Description

The Python capitalize() method converts the first letter of a string to uppercase and the rest to lowercase.

Syntax

The syntax for the capitalize() method is:

str.capitalize()

Parameters

Return Value

This method returns a string with the first letter capitalized.

Example

The following example demonstrates the capitalize() method:

#!/usr/bin/python3

str = "this is string Example From tutorialpro....wow!!!"

print ("str.capitalize() : ", str.capitalize())

The output of the above example is:

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

Python3 Strings

❮ Python Intro Python Linear Search ❯