isupper_Python字符串| isupper()和islower()方法以及示例
isupper
isupper() and islower() both are the in- built methods in Python which works with the strings.
isupper()和islower()都是Python中的内置方法,可与字符串一起使用。
1)字符串isupper()方法 (1) String isupper() Method)
isupper() returns "true" if all characters of the string are uppercase character.
如果字符串的所有字符均为大写字符,则isupper()返回“ true”。
Syntax:
句法:
String.isupper()
Parameter: None
参数:无
Return type:
返回类型:
true - if all characters of the string are uppercase characters.
true-如果字符串的所有字符均为大写字符。
false - if any of the characters is not in uppercase character.
false-如果任何字符都不大写。
Example:
例:
# str1 with all uppercase characters
str1 = "GOOGLE"
print str1.isupper()
# str2 with uppercase character, DOT, SPACE
str2 = "GOOGLE.COM"
print str2.isupper()
# str3 with uppercase and lowercase characters
str3 ="GOOGLE.com"
print str3.isupper()
# str4 with all lowercase characters
str4 = "google.com"
print str4.isupper()
Output
输出量
True
True
False
False
2)字符串islower()方法 (2) String islower() Method)
islower() returns "true" if all characters of the string are lowercase character.
如果字符串的所有字符均为小写字符,则islower()返回“ true”。
Syntax:
句法:
String.islower()
Parameter: None
参数:无
Return type:
返回类型:
true - if all characters of the string are lowercase characters.
true-如果字符串的所有字符均为小写字符。
false - if any of the characters is not in lowercase character.
false-如果任何字符都不是小写字符。
Example:
例:
# str1 with all lowercase characters
str1 = "google"
print str1.islower()
# str2 with lowercase character, DOT, SPACE
str2 = "google.com"
print str2.islower()
# str3 with lowercase and uppercase characters
str3 ="google.COM"
print str3.islower()
# str4 with all uppercase characters
str4 = "GOOGLE.COM"
print str4.islower()
Output
输出量
True
True
False
False
翻译自: https://www.includehelp.com/python/string-isupper-and-islower-methods-with-examples.aspx
isupper
isupper_Python字符串| isupper()和islower()方法以及示例相关推荐
- isupper_Python字符串isupper()
isupper Python String isupper() function returns True if all the cased characters are in Uppercase. ...
- Python字符串| join()方法与示例
join() is an in-built method in Python and it is used to join elements of the list, string etc with ...
- Python字符串| isdigit()方法与示例
isdigit() is an in-built method in Python, which is used to check whether a string contains only dig ...
- Python字符串| isdecimal()方法与示例
isdecimal() is an in-built method in Python, which is used to check whether a string contains only d ...
- isnumeric_Python字符串| isnumeric()方法与示例
isnumeric isnumeric() is an in-built method in Python, which is used to check whether a string conta ...
- isalpha函数 python怎么用_Python字符串| isalnum()和isalpha()方法以及示例
1)isalpha()方法 isalpha()如果字符串的所有字符都是字母(" A"至" Z"之间以及" a"至" z" ...
- 字符串startswith_JavaScript字符串startsWith()方法与示例
字符串startswith 字符串startsWith()方法 (String startsWith() Method) startsWith() method is a string method ...
- charcodeat_JavaScript字符串charCodeAt()方法及示例
charcodeat 字符串charCodeAt()方法 (String charCodeAt() Method) charCodeAt() Method is a string method in ...
- Python字符串join()方法
Python string join() method creates a string from an iterable. It joins all the iterable elements wi ...
- python字符串startswith_Python 字符串 startswith() 使用方法及示例
Python 字符串 startswith() 使用方法及示例 如果字符串以指定的前缀(字符串)开头,则startswith()方法将返回True.如果不是,则返回False. startswith( ...
最新文章
- 自定义堆栈(回文检测)
- C#调用C++dll
- 白话Elasticsearch73_ES生产集群中的索引管理02
- 成功解决Building wheels for collected packages: dlib Running setup.py bdist_wheel for dlib ... error
- 不使用jQuery对Web API接口POST,PUT,DELETE数据
- 在windows上搭建Apache+Trac+Subversion
- 20 个势头最猛的开发者工具
- BUUCTF--- LFI-------本地文件包含(Local File Include)
- 软件测试学习指南(更新中)
- HTTP 返回304
- 除了待办清单,用 Things 还能做什么?
- Dubbo视频教程(Dubbo项目实战)
- 萤火虫算法求解简单TSP问题
- Java同步锁synchronized的最全总结
- minitab学习系列(2)--CPK、PPK案例解析
- web开发html如何把图片居中,css中怎么让img图片居中
- Gap Statistic算法详解
- pl/sql 执行sql文件以及批量执行sql文件
- css动态特效 @keyframes
- Linux简介-远程操作-文本编辑器-1