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:
Intelligent Projects Using Python - Santanu Pattanayak
Python iter()
Python Program to Find Hash of File
Converting a Stack Trace to a String in Java
Python Program to Print the Fibonacci sequence
Python Program to Display Powers of 2 Using Anonymous Function
Python Program to Count the Number of Each Vowel
Python Program to Find LCM
Python Program to Check If Two Strings are Anagram
Python Program to Delete an Element From a Dictionary
Python Sets
Python Program to Remove Duplicate Element From a List
Python Program to Append to a File
Python Deep Learning Cookbook - Indra den Bakker
Python Program to Count the Number of Occurrence of a Character in String
Python String split()
Python String isidentifier()
Python Dictionary setdefault()
Statistical Methods for Machine Learning - Disconver how to Transform data into Knowledge with Pytho...
Python max()
Python Program to Find Sum of Natural Numbers Using Recursion
Python input()
Python enumerate()
Python String title()
Python String join()
Python Generators
Python String isalpha()
Python strftime()
Python Set difference()
Python Program to Sort a Dictionary by Value
Generate a String
Check if a String is a Palindrome in Java