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 Set symmetric_difference_update()
Python Program to Print Hello world!
Python Functions
Python exec()
Python frozenset()
Check If a String Is Numeric in Java
Python object()
Python Input, Output and Import
Python Directory and Files Management
Python Program to Count the Number of Occurrence of a Character in String
Encode a String to UTF-8 in Java
Building Machine Learning Systems with Python - Willi Richert & Luis Pedro Coelho
Python Program to Check Armstrong Number
Python String find()
Python String partition()
Python Program to Transpose a Matrix
Machine Learning Mastery with Python - Understand your data, create accurate models and work project...
Converting a Stack Trace to a String in Java
Python Tuple
Python Program to Convert Decimal to Binary Using Recursion
Python Program to Sort Words in Alphabetic Order
Python Set union()
Python Dictionary popitem()
Python Program to Merge Two Dictionaries
Python Program to Find HCF or GCD
Python Numbers, Type Conversion and Mathematics
Python Set symmetric_difference()
Python bool()
Python Program to Split a List Into Evenly Sized Chunks
Python String islower()
Python Program to Convert String to Datetime
Python Dictionary setdefault()