如果字符串中的所有字符均为大写,Python的 isupper()方法将返回True。如果字符不是大写,则返回False。
isupper()
它返回True或False。
链接:https://www.learnfk.comhttps://www.learnfk.com/python3/python-string-isupper-method.html
来源:LearnFk无涯教程网
让无涯教程看一下isupper()方法的一些例子,以了解它的功能。
# Python isupper() method example # 变量声明 str = "WELCOME TO LEARNFK" # 函数调用 str2 = str.isupper() # 显示结果 print(str2)
输出:
True
# Python isupper() method example str = "WELCOME TO LEARNFK" str2 = str.isupper() print(str2) str3 = "Learn Java Here." str4 = str3.isupper() print(str4)
输出:
True False
# Python isupper() method example str = "WELCOME TO LEARNFK" str2 = str.isupper() print(str2) str3 = "WELCOME To LEARNFK." str4 = str3.isupper() print(str4) str5 = "123 @#$ -JAVA." str6 = str5.isupper() print(str6)
输出:
True False True
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)