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:
Intelligent Projects Using Python - Santanu Pattanayak
Python Program to Iterate Over Dictionaries Using for Loop
Python Dictionary
JavaScript Methods of RegExp and String
Python pass statement
Java – String to Reader
Python @property decorator
Python Errors and Built-in Exceptions
Python Anonymous / Lambda Function
Python oct()
Python Program to Check Whether a String is Palindrome or Not
Python Machine Learning Third Edition - Sebastian Raschka & Vahid Mirjalili
Python Program to Print Output Without a Newline
Python Dictionary update()
Python String isalpha()
Python Program to Compute all the Permutation of the String
Python Program to Get the File Name From the File Path
Python Set difference_update()
Python String isupper()
Python Iterators
Convert String to Byte Array and Reverse in Java
Python Objects and Classes
Python String startswith()
Python Program to Count the Number of Occurrence of a Character in String
Python Program to Find Factorial of Number Using Recursion
Python Sets
Python Program to Randomly Select an Element From the List
Java Program to Permute All Letters of an Input String
Python Program to Print all Prime Numbers in an Interval
Python hash()
Python set()
Python Program to Multiply Two Matrices