all Python 3Byte sequencesfunction
bytes.islower
bytes — is* checks
Check that all cased bytes are lower-case.
Syntax
b.islower(...)
A common trap: islower() is not the negation of isupper(). When there are no cased bytes at all (b'123', b'!!!', b''), both return False, so "not lower-case therefore upper-case" is a wrong inference. Only ASCII letters count as cased here: a byte like b'\xe9' (é in latin-1) is not a letter for this check, so decode to str first when the data is not ASCII.
Examples
print(b'abc'.islower()) # → True
print(b'abc1!'.islower()) # → True
print(b'Hello'.lower().islower()) # → True
print(b'Abc'.islower()) # → False
print(b'123'.islower()) # → False
print(b''.islower()) # → False
See also
Open in the full glossarydocs.python.orgReport an inaccuracy