Python字串islower()方法

Python字串islower()方法檢查字串的所有基於可大小寫的字元(字母)是否都是小寫組成。

語法

以下是islower()方法的語法 -

str.islower()

參數

  • NA

返回值

  • 如果字串中的所有可大小字元都是小寫,並且至少有一個可大小的字元,則此方法返回true,否則返回false

示例

以下示例顯示了islower()方法的用法。

#!/usr/bin/python3
#coding=utf-8


str = "Welcom to zaixian python tutorials!"
print (str.islower())

str = "welcom to zaixian python tutorials!"
print (str.islower())

當運行上面的程式,它產生以下結果 -

False
True

上一篇: Python字串 下一篇: Python列表