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

us
Visit us
code
Hide code
Code
Output
Hide output
Hide output
Loading...

All contributors

Looking to contribute?

Learn Python on Codecademy