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 Program to Concatenate Two Lists
CharSequence vs. String in Java
Python while Loop
Python any()
APIs in Node.js vs Python - A Comparison
Python strptime()
Python help()
Deep Learning with Python - Francois Cholletf
Count Occurrences of a Char in a String
Python float()
Python Package
Python set()
Python Namespace and Scope
Python String rjust()
Python Program to Find LCM
Python Inheritance
Python Program to Sort a Dictionary by Value
Python Set discard()
Python Custom Exceptions
Machine Learning Applications Using Python - Cases studies form Healthcare, Retail, and Finance - Pu...
Java – Generate Random String
Python Program to Convert Decimal to Binary Using Recursion
Python id()
Java – String to Reader
Python Program to Access Index of a List Using for Loop
Python Dictionary values()
Python break and continue
Python String isnumeric()
Python for Programmers with introductory AI case studies - Paul Deitel & Harvey Deitel
Python Deeper Insights into Machine Learning - Sebastian Raschka & David Julian & John Hearty
Python String index()
Python String encode()