This upper() method in Python string returns the copy of the string where all the case-based characters have been uppercased. In Python, the upper() method refers to a built-in method that is used for string handling. The upper() method in Python string returns the uppercase string from the string provided. It turns all the lowercase characters into uppercase. In case no lowercase characters exist, then it would return the original string.
Following is the syntax for upper() method:
This method returns a copy of the string where all the case-based characters have been uppercased.
The following example below shows the usage of upper() method.
#!/usr/bin/python str = "this is string example....wow!!!"; print "str.capitalize() : ", str.upper()
When the above program is run, it produces the following result:
str.capitalize() : THIS IS STRING EXAMPLE....WOW!!!
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.