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 Create a Long Multiline String
Count Occurrences of a Char in a String
Natural Language Processing with Python - Steven Bird & Ewan Klein & Edward Loper
Python String isalpha()
Split a String in Java
Python Program to Calculate the Area of a Triangle
Python dir()
Python Program to Iterate Over Dictionaries Using for Loop
Python Program to Convert Decimal to Binary, Octal and Hexadecimal
Python for Programmers with introductory AI case studies - Paul Deitel & Harvey Deitel
Python Program to Shuffle Deck of Cards
Python Program to Find Armstrong Number in an Interval
Python Sets
Python Deep Learning Cookbook - Indra den Bakker
Converting a List to String in Java
Python time Module
Python Shallow Copy and Deep Copy
Python String translate()
Python open()
Python Machine Learning Cookbook - Practical solutions from preprocessing to Deep Learning - Chris A...
Python sum()
Python String index()
Python isinstance()
Python del Statement
How to get current date and time in Python?
Python if...else Statement
Machine Learning with Python for everyone - Mark E.Fenner
Python Program to Get a Substring of a String
Python Set intersection_update()
Python Program to Display Calendar
Python Program to Check the File Size
Python String find()