istitle() String Method in Python with Examples
istitle()
method returns True
if the string is a title cased string otherwise it returns False
.
In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
Example 1: istitle() String Method
message = 'Welcome To Python'
if message.istitle():
print('"%s" is title cased string.' %(message))
else:
print('"%s" is not title cased string string.' %(message))
Output
"Welcome To Python" is title cased string.
Example 2: istitle() String Method
message = 'Welcome to python'
if message.istitle():
print('"%s" is title cased string.' %(message))
else:
print('"%s" is not title cased string string.' %(message))
Output
"Welcome to python" is not title cased string string.
Related String Methods