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:
True
if the string is a titlecased stringFalse
if 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 List reverse()
Python Set symmetric_difference()
Python float()
Python Statement, Indentation and Comments
Python String isupper()
Python RegEx
Python oct()
Java – Reader to String
Python Program to Capitalize the First Character of a String
Python sorted()
Python int()
Python Program to Differentiate Between del, remove, and pop on a List
Python List pop()
Python String format_map()
Python bin()
Python Multiple Inheritance
Deep Learning with Python - A Hands-on Introduction - Nikhil Ketkar
Python Program to Make a Simple Calculator
Python File I/O Operation
Python timestamp to datetime and vice-versa
Python Exception Handling Using try, except and finally statement
Python Program to Find the Factorial of a Number
Node.js vs Python for Backend Development
Python str()
Python String lower()
Python Program to Display Calendar
Python if...else Statement
APIs in Node.js vs Python - A Comparison
Python Tuple
Python pass statement
Python Global Keyword
Python Dictionary copy()