Python string capitalize() method

Python String capitalize() Method

Description

The capitalize() method returns a string with only the first letter capitalized.

Syntax

var.capitalize()

Parameters

None

Return Value

String

Example

var = "this is string example....wow!!!"
var1 = var.capitalize()

print ("Original string:", var)
print ("After capitalization:", var1)

This will produce the following output: −

Original string: this is string example....wow!!!
After capitalization: This is string example....wow!!!

Leave a Reply

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