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 copy()
Python Anonymous / Lambda Function
Python Variables, Constants and Literals
Python frozenset()
Python open()
Python staticmethod()
Python String isupper()
Python any()
Python Program to Slice Lists
Python Program to Extract Extension From the File Name
Natural Language Processing with Python - Steven Bird & Ewan Klein & Edward Loper
Python Set issuperset()
Python Program to Get a Substring of a String
Python Program to Randomly Select an Element From the List
Python List count()
Why String is Immutable in Java?
Array to String Conversions
Python map()
Python while Loop
Python tuple()
Python Program to Reverse a Number
Python Program to Get the Full Path of the Current Working Directory
Split a String in Java
Python Recursion
Deep Learning in Python - LazyProgrammer
Python Program to Solve Quadratic Equation
Python List remove()
Python Machine Learning Eqution Reference - Sebastian Raschka
Python Program to Shuffle Deck of Cards
Java String Conversions
Python oct()
Python id()