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 hex()
Python getattr()
Python hash()
Converting a Stack Trace to a String in Java
Applied Text Analysis with Python - Benjamin Benfort & Rebecca Bibro & Tony Ojeda
Python type()
Python max()
How to get current date and time in Python?
Python String isdecimal()
Java String Conversions
Python Program to Extract Extension From the File Name
Python Program to Print the Fibonacci sequence
Python String splitlines()
Python Strings
Python ascii()
Python setattr()
Python Artificial Intelligence Project for Beginners - Joshua Eckroth
Python Program to Slice Lists
Python Program Read a File Line by Line Into a List
Python Closures
Python Data Analytics with Pandas, NumPy and Matplotlib - Fabio Nelli
Python Program to Return Multiple Values From a Function
Learning scikit-learn Machine Learning in Python - Raul Garreta & Guillermo Moncecchi
Adding a Newline Character to a String in Java
Python Program to Concatenate Two Lists
Python Set add()
Convert Character Array to String in Java
Python Program to Differentiate Between del, remove, and pop on a List
Deep Learning with Python - Francois Cholletf
Deep Learning with Python - Francois Chollet
Python Program to Convert Celsius To Fahrenheit
Deep Learning with Python - A Hands-on Introduction - Nikhil Ketkar