Python String Upper (Uppercase) Method

In python, the string upper() method is useful to convert all the string characters to uppercase. Generally, the upper() method will convert all the lowercase letters in a string to uppercase. In case, if no lowercase letters in a string, it will return the original string.

 

Following is the pictorial representation of the string upper() method functionality in python.

 

Python string uppercase method example result

 

If you observe the above diagram, we are trying to convert the given string “Hi guest Hi” to uppercase using the upper function in python. The upper() method has returned the string by converting all the string characters to uppercase.

String Upper Method Syntax

Following is the syntax of defining a string upper method in python.

 

string.upper()

The python upper() method will not accept any parameters.

String Upper Method Example

Following is the example of converting the given string characters to uppercase using the string upper() method in python.

 

msg1 = "Hi guest Hi"
print(msg1.upper())
msg2 = "welcome to tutlane"
print(msg2.upper())
msg3 = "LEARN PYTHON"
print(msg3.upper())

If you observe the above example, we are converting the given string characters to uppercase using the upper() method.

 

When you execute the above python program, you will get the result as shown below.

 

HI GUEST HI
WELCOME TO TUTLANE
LEARN PYTHON

This is how you can use the string upper() method in python to convert all the given string characters to uppercase based on your requirements.