Python Tutorial Python Advanced Python References Python Libraries

Python String - upper() Method



The Python upper() method is used to convert all characters of the string in uppercase. Any symbol, space, special character or number in the string is ignored while applying this method. Only Alphabets are converted.

Syntax

string.upper()

Parameters

No parameter is required.

Return Value

Returns the string with all characters of the specified string in uppercase.

Example:

In the example below, upper() method is used to convert all characters of the string in uppercase.

MyString = "hello john!"
print(MyString.upper())

The output of the above code will be:

HELLO JOHN!

❮ Python String Methods