logo

Python String Capitalize() Method


Show

The capitalize() method in Python String returns a copy of the string that has its first character capitalized only. The capitalize() method in Python string is responsible for converting the first character of the string to uppercase i.e. capital letter. In case the string owns its first character as capital then this function would return the original string.

Syntax

str.capitalize()

Parameters

  • NA

Return Value

string

Example

#!/usr/bin/python

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

Result

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

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.