Python isupper() method

Python 字符串Python String


Description

The Python isupper() method checks whether all letters in the string are uppercase.

Syntax

The syntax of the isupper() method is:

str.isupper()

Parameters

  • None.

Return Value

Returns True if the string contains at least one case-sensitive character, and all these (case-sensitive) characters are uppercase; otherwise, it returns False.

Example

The following example demonstrates the isupper() method:

Example

#!/usr/bin/python

str = "THIS IS STRING EXAMPLE....WOW!!!";
print ( str.isupper() );

str = "THIS is string example....wow!!!";
print ( str.isupper() );

The output of the above example is:

True
False

Python 字符串Python String

Other Extensions