python如何判断字符是否大写
发布时间:2021-03-22 编辑:jiaochengji.com
教程集为您提供python如何判断字符是否大写等资源,欢迎您收藏本站,我们将为您提供最新的python如何判断字符是否大写资源
例子:
>>> str_1 = "HELLO PYTHON" # 全大写 >>> str_2 = "Hello PYTHON" # 大小写混合 >>> str_3 = "Hello Python" # 单词首字母大写 >>> str_4 = "hello python" # 全小写
isupper()判断是否全是大写
>>> str_1.isupper() True >>> str_2.isupper() False >>> str_3.isupper() False >>> str_4.isupper() False
islower()判断是否全是小写
>>> str_1.islower() False >>> str_2.islower() False >>> str_3.islower() False >>> str_4.islower() True
istitle()判断首字母是否大写,其余的是否小写
>>> str_1.istitle() False >>> str_2.istitle() False >>> str_3.istitle() True >>> str_4.istitle() False
python学习网,免费的在线学习python平台,欢迎关注!
您可能感兴趣的文章:
python如何判断字符是否大写
python用函数怎么判断大小写
python如何判断字符串是否有空格
python怎么判断大小写
python如何判断字典key是否包含字符k
python如何判断字符串不为空格
用python怎么判断字符串是纯英文?
python如何判断变量是否是字符串
python如何判断字符串以什么结尾
python如何判断字符是否为字母
上一篇:python如何判断变量是否是元组
下一篇:python如何求欧几里得
[关闭]