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 sleep()
Python Program to Convert String to Datetime
Python Program to Multiply Two Matrices
Python Program to Display Fibonacci Sequence Using Recursion
Python String isalpha()
Python String isnumeric()
Python String encode()
Python Program to Convert Decimal to Binary Using Recursion
Python ord()
Python Program to Sort a Dictionary by Value
Python String endswith()
Python Program to Convert Bytes to a String
Most commonly used String methods in Java
Python Program to Safely Create a Nested Directory
Python List reverse()
Python String rindex()
Python Statement, Indentation and Comments
Convert Character Array to String in Java
Python String title()
Python Program to Find the Size (Resolution) of a Image
Python float()
Python Program to Transpose a Matrix
Python Program to Add Two Matrices
Python print()
Python all()
Convert String to Byte Array and Reverse in Java
Python Matrices and NumPy Arrays
Python format()
Python Program to Display the multiplication Table
Python Program to Extract Extension From the File Name
Python Dictionary setdefault()
Python Program to Compute the Power of a Number