How to Use String upper() Function?

The string upper() function is a simple and easy-to-use function. You just need to call the upper() function with the string object. Let’s understand how to convert string to uppercase(capital) with an example:

Python3




#initializing a string
original_text = "convert to uppercase"
#using upper function
upper_text = original_text.upper()
#printing uppercase string
print(upper_text)


Output

CONVERT TO UPPERCASE

Python String upper() Function

Python String upper() method converts all lowercase characters in a string into uppercase characters and returns it.

Example:

Python3




original_text = "lisT Upper"
upper_text = original_text.upper()
print(upper_text)


Output

LIST UPPER

Similar Reads

What is the String upper() Method?

...

Python String upper() Syntax

String upper() is an in-built function in Python, that converts all the letters in a string to uppercase(capital) and then returns it....

How to Use String upper() Function?

string.upper()...

Methods to Convert String to Uppercase

The string upper() function is a simple and easy-to-use function. You just need to call the upper() function with the string object. Let’s understand how to convert string to uppercase(capital) with an example:...