Python Istitle String Method

Veröffentlicht am: 29 September 2015
auf dem Kanal: Code master
2,315
37

Be sure to like, share and comment to show your support for our tutorials.

=======================================
Channel - https://goo.gl/pnKLqE
Playlist For This Tutorial - https://goo.gl/EyZFti
Latest Video - https://goo.gl/atWRkF
Facebook -   / mastercodeonline  
Twitter - https://twitter.com/mastercodeonlin?l...
Website - http://mastercode.online
======================================
Python Istitle String Method
In this Python tutorial, we will look at the Python istitle string method. The istitle string method looks a string object and determines if the string object is a title. A title would be an uppercase character followed by a lowercase character and lowercase characters are followed by additional lowercase characters. If the string object is a title the Python will return True and if the string object is not a title it will return False.

Python Istitle String Method Syntax
'String Object'.istitle()

'String Object' - This is a string object that may or may not contain a title format.
.istitle() - The istitle string method checks if the string is in title format. If the string has an uppercase character followed by a lowercase character than Python will return True if not then Python returns False.
Examples Of The Python Istitle String Method
#Example 1
'Title'.istitle()
True

#Example 2
'title'.istitle()
False

#Example 3
'This Is A Title'.istitle()
True

#Example 4
'THIS IS NOT A TITLE'.istitle()
False

#Example 5
'NoR iS tHiS a Title'.istitle()
False
Examples Explained

Example 1:

'Title'.istitle()- In this example, we create a string object and then we call the istitle string method on our string object.

True - We are returned True because the first letter is an uppercase character followed by lowercase letters

Example 2:

'title'.istitle() - We create a string object that only contains lowercase letters and we call the istitle string method on our string object.

False- We are returned a False boolean since the first character in 'title' is not uppercase.
Example 3:

'This Is A Title'.istitle() - We create a string object with the proper title format and then call the istitle string method on our string object.

True - We are returned a True boolean since the string is in a proper title format. The uppercase letters are followed by lowercase letters.
Example 4:

'THIS IS NOT A TITLE'.istitle() - We create a new string object that contains all uppercase letters and then we call the istitle string method.

False - We are returned False since our string object only contains uppercase letters.
Example 5:

'NoR iS tHiS a Title'.istitle() - We create a string with alternating uppercase and lowercase letters and then we call our string method of istitle on our string object.

False - We are returned False since an uppercase letter can only be followed by lowercase letters.
Conclusion

In this Python tutorial we looked at the Python istitle string method which checks if a string object is in a title format. If you have any questions about the istitle string method leave a comment below.


Auf dieser Seite können Sie das Online-Video Python Istitle String Method mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Code master 29 September 2015 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 2,315 Mal angesehen und es wurde von 37 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!