isupper_Python字符串isupper()
isupper
Python String isupper() function returns True
if all the cased characters are in Uppercase. If the string is empty or there are no cased characters then it returns False
.
如果所有大小写的字符均为大写,则Python String isupper()函数将返回True
。 如果字符串为空或没有大小写字符,则返回False
。
Python字符串isupper() (Python String isupper())
Cased characters are those with general category property being one of “Lu” (Letter, uppercase), “Ll” (Letter, lowercase), or “Lt” (Letter, titlecase).
大小写字符是那些具有常规类别属性的字符,它们是“ Lu”(字母大写),“ Ll”(字母小写)或“ Lt”(字母大写)之一。
Let’s look at some examples of isupper() function.
让我们看一下isupper()函数的一些示例。
s = 'HELLO WORLD'
print(s.isupper())
Output: True
because all the cased characters are in Uppercase.
输出: True
因为所有大小写的字符均为大写。
s = 'Hello World'
print(s.isupper())
Output: False
because there are some cased characters in lowercase.
输出: False
因为有一些小写的大小写字符。
s = 'HELLO WORLD 2019'
print(s.isupper())
Output: True
because all the cased characters are in Uppercase. The numbers in the string are not cased characters.
输出: True
因为所有大小写的字符均为大写。 字符串中的数字不是大小写字符。
s = ''
print(s.isupper())
Output: False
because string is empty.
输出: False
因为字符串为空。
s = '2019'
print(s.isupper())
Output: False
because string doesn’t have any cased character.
输出: False
因为string没有任何大小写的字符。
Let’s look at an example with special characters string.
让我们看一个带有特殊字符串的示例。
s = 'ÂƁȻ2019'
print(s.isupper())
Output: True
because all the cased characters in the string are in Uppercase.
输出: True
因为字符串中所有大小写的字符均为大写。
打印所有大写字母 (Print All Uppercase Cased Characters)
Here is a simple program to print information about all the Uppercase cased characters.
这是一个用于打印有关所有大写字母大写字符的信息的简单程序。
import unicodedatacount = 0
for codepoint in range(2 ** 16):ch = chr(codepoint)if ch.isupper():print(u'{:04x}: {} ({})'.format(codepoint, ch, unicodedata.name(ch, 'UNNAMED')))count = count + 1
print(f'Total Number of Uppercase Unicode Characters = {count}')
Output:
输出:
0041: A (LATIN CAPITAL LETTER A)
0042: B (LATIN CAPITAL LETTER B)
0043: C (LATIN CAPITAL LETTER C)
...
ff38: X (FULLWIDTH LATIN CAPITAL LETTER X)
ff39: Y (FULLWIDTH LATIN CAPITAL LETTER Y)
ff3a: Z (FULLWIDTH LATIN CAPITAL LETTER Z)
Total Number of Uppercase Unicode Characters = 1154
Reference: Official Documentation
参考: 官方文档
翻译自: https://www.journaldev.com/24273/python-string-isupper
isupper
isupper_Python字符串isupper()相关推荐
- python字符串大写字母个数_python判断字符串是字母 数字 大小写(转载)
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 今天遇到的字符串处理的问题,记录一下方便使用 str1 = input('请输入一个字符:') #初始化字符.数字.空格.特殊字符的计数 lowercas ...
- python判断字符_python判断字符串是字母 数字 大小写(转载)
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 今天遇到的字符串处理的问题,记录一下方便使用 str1 = input('请输入一个字符:') #初始化字符.数字.空格.特殊字符的计数 lowercas ...
- python判断是否是小写字母_python判断字符串是字母 数字 大小写(转载)
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 今天遇到的字符串处理的问题,记录一下方便使用 str1 = input('请输入一个字符:') #初始化字符.数字.空格.特殊字符的计数 lowercas ...
- python字符串的表示_Python字符串方法总结
Python字符串方法图示: (温馨提示:对图片点右键--在新标签页中打开图片) 1.index() 定义:查找并返回指定str的索引位置,如果没找到则会抛异常(查找的顺序是从左至右)可以指定范围:开 ...
- python print 输出到txt_(Python基础教程之七)Python字符串操作
Python基础教程 在SublimeEditor中配置Python环境 Python代码中添加注释 Python中的变量的使用 Python中的数据类型 Python中的关键字 Python字符串操 ...
- python中怎么判断字母大小写_python判断字符串是字母 数字 大小写(转载)
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 今天遇到的字符串处理的问题,记录一下方便使用 str1 = input('请输入一个字符:') #初始化字符.数字.空格.特殊字符的计数 lowercas ...
- string是python内置函数吗_Python 字符串与内置函数(方法)
一.字符串 1.字符串定义 a.定义时用成对双引号或成对单引号 b.也可以用成对的三个双引号或成对的三个单引号定义字符串(定义的字符串用包含单引号或双引号时可以用这个方法) c.字符串中间有单引号时, ...
- python字符串_(Python基础教程之七)Python字符串操作
Python基础教程 在SublimeEditor中配置Python环境 Python代码中添加注释 Python中的变量的使用 Python中的数据类型 Python中的关键字 Python字符串操 ...
- python判断字母大写_python判断字符串是字母 数字 大小写(转载)
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 今天遇到的字符串处理的问题,记录一下方便使用 str1 = input('请输入一个字符:') #初始化字符.数字.空格.特殊字符的计数 lowercas ...
最新文章
- ARouter::Compiler No module name, for more information, look at gradle log
- Eclipse的JQuery提示插件-Spket(别试了,没什么效果,且安装设置麻烦)
- Windows10 家庭版添加【本地组策略编辑器】
- 数据结构+算法——错题总结
- java io 文件路径格式_java中iofile的路径问题,确定一个未知方法所需要的文件路径...
- Android的Toast介绍-android学习之旅(三十六)
- SAP S/4HANA销售订单创建时,会自动触发生产订单的创建 1
- [SpringSecurity]HelloWorld入门案例
- mysql优化之query优化
- Highcharts:小案例,自定义图片下载路径,中文乱码的解决办法(不足之处,求指点)。...
- Python读写Excel简单案例及调试说明文档
- linux 执行文件命令
- Python安装和环境配置
- 无线渗透(四)WPA攻击
- 星际蜗牛8盘位装机记录 蜗牛C双全 益衡7030电源
- RT-Preempt笔记
- python 入门篇 之 正则表达式re.findall的使用
- 远程控制 - 手机完全控制电脑之TeamViewer
- java tapestry_Java Web 框架 Tapestry
- java短链接_Java 网址短链接服务原理及解决方案