Python Tutorial Python Advanced Python References Python Libraries

Python String - isupper() Method



The Python isupper() method is used to check whether all characters of the string are in uppercase or not. It returns true when all characters of the string are in uppercase, else returns false. Any symbol, space, or number in the string is ignored while applying this method. Only alphabet are checked.

Syntax

string.isupper()

Parameters

No parameter is required.

Return Value

Returns True if all characters of the specified string are in uppercase, else returns False.

Example:

In the example below, isupper() method is used to check whether all characters of the given string are in uppercase or not.

MyString = "Hello John"
print(MyString.isupper())

MyString = "HELLO JOHN"
print(MyString.isupper())

The output of the above code will be:

False   
True   

Example:

When the string contains any symbol, space, or number, it is ignored by the method. It only checks alphabet. Consider the following example.

MyString = "#$%@!()HELLO"
print(MyString.isupper())

The output of the above code will be:

True  

❮ Python String Methods