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 break and continue
Python globals()
Adding a Newline Character to a String in Java
Python Program to Find All File with .txt Extension Present Inside a Directory
Python Program to Solve Quadratic Equation
Python filter()
Check If a String Is Numeric in Java
Python Program to Find LCM
Python Dictionary clear()
Building Chatbots with Python Using Natural Language Processing and Machine Learning - Sumit Raj
Converting String to Stream of chars
Python Strings
Python String capitalize()
Python Program to Add Two Matrices
Python Program to Split a List Into Evenly Sized Chunks
Java String to InputStream
Python Machine Learning Cookbook - Practical solutions from preprocessing to Deep Learning - Chris A...
JavaScript Eval: run a code string
Python Function Arguments
Python String lstrip()
Python pass statement
Python super()
Python strptime()
Python Functions
Python Program to Create a Long Multiline String
Python Program to Convert Bytes to a String
Python String expandtabs()
Python String rsplit()
Python Recursion
Python exec()
Python Set clear()
Deep Learning from Scratch - Building with Python form First Principles - Seth Weidman