Python String istitle() Method

Determines whether the string is a titlecased string

Usage

The istitle() method returns TRUE if the string is nonempty and a titlecased string. Otherwise, it returns FALSE.

Numbers and special characters are ignored.

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

Syntax

string.istitle()

Examples

Example: Check if the string is a titlecased string

# titlecase
S = 'Hello World'
print(S.istitle())	# True
# numbers and characters
S = '*** Hello, World! 123'
print(S.istitle())	# True

Below are a few examples where istitle() method returns false.

Example:

# uppercase
S = 'HELLO, WORLD!'
print(S.istitle())	# False
# lowercase
S = 'hello, world!'
print(S.istitle())	# False