Python String upper() Method

Converts all characters in a string to uppercase

Usage

The upper() method returns a copy of the string with all the characters converted to uppercase.

The method does not change the original string.

Syntax

string.upper()

Examples

Example: Convert all characters to uppercase

S = 'Hello, World!'
x = S.upper()
print(x)	# HELLO, WORLD!

upper() method ignores numbers and special characters in a string.

Example:

S = '123 abc $@%'
x = S.upper()
print(x)	# 123 ABC $@%