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:
String Processing with Apache Commons Lang 3
Python Program to Convert Kilometers to Miles
Python Program to Find Armstrong Number in an Interval
Python Deep Learning - Valentino Zocca & Gianmario Spacagna & Daniel Slater & Peter Roelants
Python strptime()
Python Program to Extract Extension From the File Name
Case-Insensitive String Matching in Java
Python Program to Check If Two Strings are Anagram
Python issubclass()
Python Input, Output and Import
Python Program to Display Fibonacci Sequence Using Recursion
Python String isupper()
Python String rsplit()
Python Set symmetric_difference_update()
Python Program to Randomly Select an Element From the List
Python float()
Python enumerate()
Python File I/O Operation
Python datetime
Format ZonedDateTime to String
Python Program to Split a List Into Evenly Sized Chunks
Python Dictionary clear()
Python Set discard()
Python String capitalize()
Python exec()
Python String splitlines()
Converting a Stack Trace to a String in Java
Python Program to Append to a File
Python repr()
Python Program to Find Sum of Natural Numbers Using Recursion
Python Deep Learning Cookbook - Indra den Bakker
Python Statement, Indentation and Comments