Python String isupper() Method

Determines whether string contains uppercase characters

Usage

The isupper() method return TRUE if all cased characters in the string are uppercase and there is at least one cased character, false otherwise.

Syntax

string.isupper()

Examples

# Check if all characters in the string are uppercase
S = 'ABCD'
x = S.isupper()
print(x)
# Prints True

The method returns FALSE, if the string doesn’t contain at least one cased character.

S = '123$@%'
x = S.isupper()
print(x)
# Prints False

S = 'A123$@%'
x = S.isupper()
print(x)
# Prints True

The method also returns FALSE, if the string contains at least one lowercase alphabet.

S = 'ABCDe'
x = S.isupper()
print(x)
# Prints False