Skip to main content

Python String istitle() Function

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

note

Numbers and special characters are ignored.

note

In titlecased, string each word starts with an uppercase character and the remaining characters are lowercase.

Syntax

my_string.istitle()

istitle() Parameters

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

istitle() Return Value

Python String istitle() function 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