Python3 isupper()方法

Python3 字符串 Python3 字符串


描述

isupper() 方法檢測(cè)字符串中所有的字母是否都為大寫。

語(yǔ)法

isupper()方法語(yǔ)法:

str.isupper()

參數(shù)

  • 無。

返回值

如果字符串中包含至少一個(gè)區(qū)分大小寫的字符,并且所有這些(區(qū)分大小寫的)字符都是大寫,則返回 True,否則返回 False

實(shí)例

以下實(shí)例展示了isupper()方法的實(shí)例:

#!/usr/bin/python3

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

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

以上實(shí)例輸出結(jié)果如下:

True
False

Python3 字符串 Python3 字符串