Python String istitle() Method
The istitle() function returns True if the string is a title. otherwise it returns False.
"title" means: that all words in the string must begin with uppercase letters and the remaining characters must be lowercase.
How to formulate it like this:
string. istitle()
Return value: Returns True if a string is a title. If it is not, it returns the value False
Example:
# All words in the string begin with an uppercase letter
string = "Learn Python With Ahmed Obaid"
print(string.istitle())
#All words in the series are in lower case
string = "learn python with ahmed obaid"
print(string.istitle())
# All words in the series are capitalized
string = "LEARN PYTHON WITH AHMED OBAID"
print(string.istitle())
# Numbers are ignored
string = "My Number Is 010"
print(string.istitle())
The output will be:
True
False
False
True
In the following example, we will use the istitle() function Check the chain status. Is it a title or something else?
Example:
string = "Learn Python With Ahmed Obaid"
if string.istitle() == True:
print('This string is titled')
else:
print('This string is not a title')
The output will be:
This string is titled
External sources:
Built-in functions - official Python documentation
If you have any questions or concerns, leave them in the comments
Tags
Python Python String string methods python python string istitle method String comparison functions in Python
Share page
About author
Ahmed Obaid
Hello, I am Ahmed Obaid, an Egyptian Arabic programmer. I would like to put my experiences learning Python on this site So that it will be a reference for you and me as well.
Sign up to leave a comment
ali
I Love ❣️ python
oszero7788r
Very good
ali
I Love ❣️ python