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 Upper string Method
In this Python tutorial, we look at the Python upper string method which will convert all characters in the string object to uppercase characters. The upper string method takes no arguments.
Python Upper String Method Syntax
'String Object'.upper()
'String Object' - This is our string object which we are going to call upper string method on.
.upper() - The upper string method will convert all characters to uppercase in a new string object.
Examples Of The Python Upper String Method
#Example 1
'This is a string'.upper()
'THIS IS A STRING'
#Example 2
'this is another string'.upper()
'THIS IS ANOTHER STRING'
#Example 3
a = 'new string'
a = a.upper()
a.isupper()
True
Examples Explained
Example 1:
'This is a string'.upper() - We create a new string object and call the upper string method on our string object.
'THIS IS A STRING' - We are returned a new string object that contains all uppercase characters.
Example 2:
'this is another string'.upper() - We create a new string object and call the upper string method on our string object.
'THIS IS ANOTHER STRING' - We are returned a string object that contains all uppercase characters.
Example 3:
a = 'new string' - We create a new string object and assign the variable a to the new string object.
a = a.upper() - We call the upper string method on our string object via the variable a then we reassign the variable a to the new string object
a.isupper() - We then call the isupper string method to show that characters have been converted to uppercase.
Conclusion
In this tutorial we took a look at the upper string method in Python. This string method will convert all characters to uppercase in a new string object. If you have any questions about the upper string method in Python leave a comment below.
Auf dieser Seite können Sie das Online-Video Python Upper String Method mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Code master 07 Oktober 2015 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 9,114 Mal angesehen und es wurde von 75 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!