bytes.islower() returns True if the bytes contain at least one ASCII lowercase letter and no ASCII uppercase letters. Digits, spaces, symbols, and non-ASCII bytes are ignored.
So b"hello 42!" is lowercase, but b"123" is not, because it has no letters at all. Use it to check whether ASCII data is already normalized before calling lower().
bytes.islower() is a method of the built-in bytes type: call it on a bytes object with dot notation, such as data.islower(...). No import is needed, and bytearray objects have the same method.
Syntax
No arguments; returns a bool.
python
result = data.islower()
Call
What it does
b"hello".islower()
Returns True.
b"hello 42!".islower()
Returns True: non-letters are ignored.
b"123".islower()
Returns False: no letters.
data.lower().islower() is True whenever data contains at least one ASCII letter.
Method signatures
python
bytes.islower()
# returns True or False; bytearray.islower() works the same way
Parameters
islower() takes no parameters.
Return Value
Return Value
Description
True
At least one ASCII lowercase letter and no ASCII uppercase letters.
False
Any uppercase letter, or no ASCII letters at all.
Python Examples
Example 1 — Lowercase, Mixed, and Letter-Free Bytes
See how letters, digits, and symbols affect the result.
python
for s in [b"hello", b"hello 42!", b"Hello", b"123", b""]:
print(s, s.islower())