Python - String isupper() Method


Advertisements

The string 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.

Example:

In the below example, isupper() method is used to check whether all characters of the string called MyString are in uppercase or not. It only checks alphabet. Any symbol, space, or number in the string is ignored by this method. It returns True when all characters of MyString are in uppercase, else returns False.

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

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

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

Output

False   
 
True   

True  

String Methods
Advertisements