.title()
Anonymous contributor
Anonymous contributor3071 total contributions
Anonymous contributor
Published Oct 15, 2021Updated Oct 19, 2021
Contribute to Docs
The .title()
string method takes in a string and returns a copy of the string formatted in the title case: each word in the string is capitalized.
Syntax
string.title()
Example 1
Use .title()
to format a string in title case:
my_string = "Codecademy docs"print(my_string.title())# Output: Codecademy Docs
Example 2
Use .title()
to format author_name
in title case:
author_name = "jane smith"print(author_name.title())# Output: Jane Smith
Codebyte Example
Use .title()
to format the string my_string
in title case:
All contributors
- Anonymous contributorAnonymous contributor3071 total contributions
- BalaPriyaC6 total contributions
- Anonymous contributor
- BalaPriyaC
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.