Python Reference Β· String Methods
Python str.islower() method
Reference for Python str.islower(): test whether all cased characters are lower case, how digits and punctuation are ignored, and how it differs from lower().
The islower() method returns True if the string contains at least one cased character and every cased character is lower case. Characters that have no case, such as digits, spaces and punctuation, are ignored, so "hello world!" and "abc123" both count as lower case.
It is a test, not a conversion. To change the case of a string, use lower().
print("python".islower()) # True print("Python".islower()) # False
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input Β· what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input Β· what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.
Syntax
str.islower()
This method takes no parameters.
Return value: True if the string has at least one cased character and no upper-case or title-case characters; otherwise False.
Raises: nothing.
Usage notes
- Needs at least one letter.
"123".islower()and"".islower()areFalsebecause there is no cased character to be lower case. - Not the opposite of
isupper(). A string can be neither:"Hello"is not lower case and not upper case, and"123"is neither too. Do not writenot s.isupper()when you means.islower(). - One capital ruins it. A single upper-case or title-case character makes the result
False, wherever it appears. - Unicode aware. Letters from other alphabets with case, like
"Γ€"or"ΠΆ", are handled. Scripts without case, such as Chinese, are ignored like digits. - Case-insensitive comparison. Use
casefold()rather than testing withislower()when comparing text. - Bytes.
bytes.islower()exists and considers only ASCII letters.