Menu Close

Python String istitle() Method

python string istitle

In this article, you will learn about the Python string istitle() method.istitle function in Python returns True if all the words in a string start with Uppercase otherwise return False.

In the previous tutorial, we have seen Python string isspace() to check a string contains only spaces or not.

Python string istitle() method

Python string istitle() method is a string method that is Return True if all the words in the string start with uppercase and rest of the letters in lowercase, Otherwise return False.

Syntax

The syntax of string istitle function in python is:-

string.istitle()

Parameter

istitle function in Python does not support any parameter.

Return Type

Python string istitle() method return only True or False.

Python string istitle example

Here will write some Python code to understand string istitle function in python.

Example 1:

str = "Programming 123 Funda"
str2 = str.istitle()
print(str2)

Output will be:- True

Example 2:

str = "12 Python"
str2 = str.istitle()
print(str2)

Output will be:- True

Example 3:

str = "Hello World"
str2 = str.istitle()
print(str2)

Output will be:- True

Example 4

str = "Python programming"
str2 = str.istitle()
print(str2)

Output will be:- False

Example 5:

str = 'Programming'
if str.istitle():
	print("Your string is title case")
else:
	print("Something wrong")

Output will be:- “Your string is title case

Note:- Python string istitle method ignore numbers and symbols.

Conclusion

Here, you have learned all about the Python string istitle() method along with some examples. This is the best way to check all the words in string starts with uppercase or not.

I hope this article will have helped you. If you like this artice, please share it with your friends who want to learn Python programming.

For More Information:- Click Here

Python String isspace() Method
Python String join() Method

Related Posts