Python String isupper() method (original) (raw)

Last Updated : 02 Jan, 2025

isupper() method in Python checks if all the alphabetic characters in a string are uppercase. If the string contains at least one alphabetic character and all of them are uppercase, the method returns True. Otherwise, it returns False.

Let’s understand this with the help of an example:

Python `

s = "GEEKSFORGEEKS" print(s.isupper())

`

Explanation:

Table of Content

Syntax of method

string.isupper()

Parameters

Return Type

Examples of method

Checking a string with all uppercase letters

Let’s examine a case where the string is entirely uppercase, we can use this to validate input when uppercase formatting is required, such as for acronyms or constants.

Python `

s1 = "PYTHON" print(s1.isupper())

`

Explanation:

Checking a string with mixed case letters

This method is helpful when we want to ensure that no lowercase letters are present in a string.

Python `

s2 = "PyThOn" print(s2.isupper())

`

Explanation:

Checking a string with non-alphabetic characters

Let’s check how isupper() behaves when the string contains numbers or special characters.

Python `

s3 = "123#@!" print(s3.isupper())

`

Explanation:

String with spaces and uppercase letters

This method is useful when validating input strings with uppercase letters and spaces, such as titles or banners.

Python `

s4 = "PYTHON IS FUN" print(s4.isupper())

`

Explanation:

5. An empty string

This is useful when we want to ensure that we’re working with meaningful input before applying further processing.

Python `

s5 = "" print(s5.isupper())

`

Explanation: