English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Python Basic Tutorial

Python Flow Control

Python Functions

Python Data Types

Python File Operations

Python Objects and Classes

Python Date and Time

Advanced Python Knowledge

Python Reference Manual

Python string istitle() usage and example

Python string methods

Check if all the words in the string are spelled with the first letter capitalized and the other letters are lowercase. If they are, the istitle() returns True. If not, it returns False.

The syntax of the istitle() method is:

string.istitle()

istitle() parameters

istitle() method does not take any parameters.

istitle() return value

istitle() method returns:

  • If all the words in the string are spelled with the first letter capitalized and the other letters are lowercase, it returns True, otherwise it returns False.

Example1How istitle() works

s = 'Python Is Good.'
print(s.istitle())
s = 'Python is good'
print(s.istitle())
s = 'This Is @ Symbol.'
print(s.istitle())
s = ''99 Is A Number
print(s.istitle())
s = 'PYTHON'
print(s.istitle())

When running the program, the output is:

True
False
True
True
False

Example2How to use istitle()?

s = 'I Love Python.'
if s.istitle() == True:
  print('istitle() is true')
else:
  print('istitle() is false')
  
s = 'PYthon'
if s.istitle() == True:
  print('istitle() is true')
else:
  print('istitle() is false')

When running the program, the output is:

istitle() is true
istitle() is false

Python string methods