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 strftime()
Python for Programmers with introductory AI case studies - Paul Deitel & Harvey Deitel
Python Program to Differentiate Between del, remove, and pop on a List
Python Program to Append to a File
Python List clear()
Python Custom Exceptions
Python Program to Randomly Select an Element From the List
Python Program to Concatenate Two Lists
Python Program to Make a Simple Calculator
Python String isalnum()
Python timestamp to datetime and vice-versa
Python Set intersection()
Python Namespace and Scope
Python Machine Learning Cookbook - Practical solutions from preprocessing to Deep Learning - Chris A...
Split a String in Java
Python List copy()
Python range()
Deep Learning with Applications Using Python - Navin Kumar Manaswi
Python Program to Convert Decimal to Binary Using Recursion
Python List index()
Python List sort()
Python Sets
Python set()
Python Closures
Python List insert()
Python Program to Display Powers of 2 Using Anonymous Function
Convert String to Byte Array and Reverse in Java
Python hash()
Python String isprintable()
Java Program to Permute All Letters of an Input String
Python RegEx
Python Program to Get the Full Path of the Current Working Directory