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