描述
islower函数检测字符串中字母是否都是小写字母。若全部的字母都是是由小写字母组成的,则返回True,否则返回False。islower函数没有参数。
语法
str.islower()
举例
1. 仅包含字母字符
test_1 = "this is test.1"
print(test_1.islower())
结果为
True
2. 包含数字、字符和符号
test_1 = "this is test"
test_2 = "this is test.1321321/*"
test_3 = "this is test.1321321A"
print(test_1.islower())
print(test_2.islower())
print(test_3.islower())
结果为
True
True
False
本文介绍了Python内置的islower()函数,该函数用于检查字符串中的所有字母是否都为小写。如果字符串全由小写字母组成,islower()返回True,否则返回False。文中通过实例展示了函数的用法,包括仅包含字母字符的情况和包含数字、符号的情况。对于含有非小写字母的字符串,islower()将返回False。
6万+

被折叠的 条评论
为什么被折叠?



