.capitalize()

Takes in a string, and returns a copy of the string in Capital Case.

Syntax

"string".capitalize()

Example 1

Use .capitalize() to set a string value to Capital Case:

Code
Output
Loading...

Example 2

Use .capitalize() to set a string value to Capital Case:

Code
Output
Loading...

Example 3

Use .capitalize() to set a string value to Capital Case:

Code
Output
Loading...

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn Python on Codecademy