Python Tutorial Python Advanced Python Resources Python Libraries
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

Python - String upper() Method



The Python String 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

5