filmov
tv
Python Upper String Method
Показать описание
Be sure to like, share and comment to show your support for our tutorials.
=======================================
======================================
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'
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.
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.
=======================================
======================================
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'
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.
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.
Комментарии