istitle() string method in Python

The istitle() string method returns True if the string is in title case:

Syntax

Python Syntax

string.istitle()

Example:

Python

text1 = "Hello World"
print(text1.istitle())   # Output: True
# Both words start with uppercase, rest lowercase

text2 = "Hello world"
print(text2.istitle())   # Output: False
# 'world' does not start with uppercase

text3 = "HELLO WORLD"
print(text3.istitle())   # Output: False
# All uppercase is NOT title case

text4 = "123 Python"
print(text4.istitle())   # Output: True
# Numbers are ignored; Python starts with uppercase

Special Notes