Python3 中的 isupper()函数

首页 / Python3入门教程 / Python3 中的 isupper()函数

如果字符串中的所有字符均为大写,Python的 isupper()方法将返回True。如果字符不是大写,则返回False。

isupper - 语法

isupper()

isupper - 返回

它返回True或False。

让无涯教程看一下isupper()方法的一些例子,以了解它的功能。

# Python isupper() method example
# 变量声明
str = "WELCOME TO LEARNFK"
# 函数调用
str2 = str.isupper()
# 显示结果
print(str2)

输出

True
isupper - Python字符串isupper()方法示例2
# Python isupper() method example
str = "WELCOME TO LEARNFK"
str2 = str.isupper()
print(str2)
str3 = "Learn Java Here."
str4 = str3.isupper()
print(str4)

输出

True
False
isupper - Python字符串isupper()方法示例3
# 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

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

快速上手Kotlin开发 -〔张涛〕

算法面试通关40讲 -〔覃超〕

Nginx核心知识150讲 -〔陶辉〕

说透敏捷 -〔宋宁〕

TensorFlow 2项目进阶实战 -〔彭靖田〕

容器实战高手课 -〔李程远〕

基于人因的用户体验设计课 -〔刘石〕

大数据经典论文解读 -〔徐文浩〕

零基础学Python(2023版) -〔尹会生〕

好记忆不如烂笔头。留下您的足迹吧 :)