Table of Contents
The istitle() returns True if the string is a titlecased string. If not, it returns False.
The syntax of istitle() method is:
string.istitle()
1. istitle() Parameters
The istitle() method doesn’t take any parameters.
2. Return Value from istitle()
The istitle() method returns:
Trueif the string is a titlecased stringFalseif the string is not a titlecased string or an empty string
3. Example 1: Working of istitle()
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())
Output
True False True True False
4. Example 2: How to use istitle()?
s = 'I Love Python.'
if s.istitle() == True:
print('Titlecased String')
else:
print('Not a Titlecased String')
s = 'PYthon'
if s.istitle() == True:
print('Titlecased String')
else:
print('Not a Titlecased String')
Output
Titlecased String Not a Titlecased String
Related posts:
Python while Loop
Python frozenset()
Node.js vs Python for Backend Development
Python Program to Merge Mails
Python Set symmetric_difference()
Python filter()
Python Program to Convert Bytes to a String
Python List extend()
JavaScript Eval: run a code string
Python compile()
Python input()
Java Program to Permute All Letters of an Input String
Python Machine Learning Second Edition - Sebastian Raschka & Vahid Mirjalili
Python strftime()
Python Program to Split a List Into Evenly Sized Chunks
Python Program to Print Hello world!
Python Program to Represent enum
Python str()
Python String rsplit()
Python Program to Find HCF or GCD
Python String islower()
String Set Queries
Python Program to Print all Prime Numbers in an Interval
Python Program to Delete an Element From a Dictionary
Python File I/O Operation
Python divmod()
Python Numbers, Type Conversion and Mathematics
Python 3 for Absolute Beginners - Tim Hall & J.P Stacey
Python open()
Python int()
Python Program to Check if a Number is Positive, Negative or 0
Python String endswith()