如果字符串中的所有字符均为小写,则Python字符串 islower()方法将返回True。如果不是小写字母,则返回False。
islower - 语法
islower()
islower - 返回
它返回True或False。
一个简单的示例,以了解如何应用此方法。它返回true,请参见下面的示例。
# Python islower() method example # 变量声明 str = "learnfk" # 函数调用 str2 = str.islower() # 显示结果 print(str2)
输出:
True
如果发现除小写字母以外的其他任何单个字符,则返回False。请参见下面的示例。
# Python islower() method example # 变量声明 str = "Welcome To Learnfk" # 函数调用 str2 = str.islower() # 显示结果 print(str2)
输出:
False
字符串也可以有数字,并且此方法在字母大小写下有效,并且忽略数字。因此它返回True,请参见下面的示例。
# Python islower() method example # 变量声明 str = "hi, my contact is 9856******" # 函数调用 str2 = str.islower() # 显示结果 print(str2)
输出:
True