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:
Converting a List to String in Java
Python Strings
Python del Statement
Python Data Structures and Algorithms - Benjamin Baka
Python strptime()
Python sleep()
Python File I/O Operation
Convert char to String in Java
Python String rstrip()
Python String center()
Python List insert()
Python List copy()
Deep Learning from Scratch - Building with Python form First Principles - Seth Weidman
Python Program to Find the Largest Among Three Numbers
Statistical Methods for Machine Learning - Disconver how to Transform data into Knowledge with Pytho...
Java String Conversions
Check if a String is a Palindrome in Java
Learning scikit-learn Machine Learning in Python - Raul Garreta & Guillermo Moncecchi
Python Keywords and Identifiers
Python compile()
JavaScript Eval: run a code string
Python Dictionary
Java InputStream to String
Python List pop()
Python Tuple count()
Python Program to Convert Two Lists Into a Dictionary
Python String isdecimal()
Python Dictionary keys()
Check If a String Is Numeric in Java
Python String maketrans()
Python Set symmetric_difference_update()
Python oct()