.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:

Example 2

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

Example 3

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

Edit this page on GitHub

Contributors

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

Learn Python on Codecademy