Skip to content

Python String istitle() Method

Check if a string is titlecased (each word starts with uppercase) using Python's istitle() method, which returns True for valid titlecase strings and False for empty strings or non-titlecase formats.

The String istitle() method returns True if the string is not empty and it is titlecased. Otherwise, it returns False.

Syntax

my_string.istitle()

istitle() Parameters

Python String istitle() method does not take any parameters.

istitle() Return Value

Python String istitle() method returns:

  • True if the string is a titlecased string
  • False if the string is not a titlecased string or it is an empty string

Examples

Example 1: Check if a String is titlecased with istitle()

The istitle() method returns True if the string is a titlecased string.

my_str = 'Tutorial Reference'
print(my_str.istitle()) # Output: True

output

True

The istitle() method returns False if the string is not a titlecased string.

For example, a string with all characters uppercase is not a titlecased string:

my_str = 'TUTORIAL REFERENCE'
print(my_str.istitle()) # Output: False

output

False

Similarly, a string with all characters lowercase is not a titlecased string:

my_str = 'tutorial reference'
print(my_str.istitle()) # Output: False

output

False

Example 3: Check if an Empty String is titlecased with istitle()

An empty string is not a titlecased string.

my_str = ''
print(my_str.istitle()) # Output: False

output

False

Example 3: Check if a String with Numbers is titlecased with istitle()

The istitle() method ignores Numbers.

my_str = 'Tutorial 123 Reference 456'
print(my_str.istitle()) # Output: True

output

True

Example 4: Check if a String with Special Characters is titlecased with istitle()

The istitle() method ignores Special Characters.

my_str = 'Tutorial, Reference!'
print(my_str.istitle()) # Output: True

output

True
Navigation