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 Machine Learning - Sebastian Raschka
Python bool()
Python Program to Check Armstrong Number
Python Program to Iterate Over Dictionaries Using for Loop
Python Program to Check If Two Strings are Anagram
Python Program to Iterate Through Two Lists in Parallel
Python Set intersection_update()
Python abs()
Python Set intersection()
CharSequence vs. String in Java
Python Program to Safely Create a Nested Directory
String Initialization in Java
Python Program to Convert Kilometers to Miles
Python Program to Make a Flattened List from Nested List
Adding a Newline Character to a String in Java
Python String maketrans()
Python String center()
Python Program to Shuffle Deck of Cards
Machine Learning with Python for everyone - Mark E.Fenner
Python String lstrip()
Python enumerate()
Python Dictionary fromkeys()
Deep Learning with Python - A Hands-on Introduction - Nikhil Ketkar
Python timestamp to datetime and vice-versa
Python Program to Split a List Into Evenly Sized Chunks
Python bytearray()
Python Function Arguments
Python String isalpha()
Python String count()
Python List extend()
Converting String to Stream of chars
Python frozenset()