.istitle()
Published Oct 9, 2023
Contribute to Docs
The .istitle()
string method returns True
if the string is in title case and False
otherwise. Title case means that the first letter of each word is capitalized, and all other letters in the word are in lowercase.
Syntax
my_string.istitle()
Example
The code below uses .istitle()
to check if a string is in title case:
my_string = "I love Codecademy Docs!"print(my_string.istitle())
Output:
False
Codebyte Example
The following code is runnable and uses .istitle()
to check if different capitalizations of the same string are in title case:
Contribute to Docs
- 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.
Learn Python on Codecademy
- Skill path
Analyze Data with Python
Learn to analyze and visualize data using Python and statistics.Includes 8 CoursesWith CertificateIntermediate13 hours - Course
Learn Python 3
Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.With CertificateBeginner Friendly23 hours