Python Glossary Русский

all Python 3Byte sequencesfunction

bytes.lower

bytes — case

Return a copy with ASCII letters lower-cased.

Syntax

b.lower(...)

It changes only the ASCII letters A–Z: UTF-8 bytes of Cyrillic and other scripts stay as they are, so 'É'.encode().lower() returns the same bytes. For text in any language decode to str first and call str.lower. For case-insensitive comparison str offers casefold.

Examples

print(b'ABC'.lower())   # → b'abc'
print(b'Hello, World!'.lower())   # → b'hello, world!'
print(b'ABC123'.lower())   # → b'abc123'
print('ÄÖ'.encode('utf-8').lower() == 'ÄÖ'.encode('utf-8'))   # → True
print(b'Yes'.lower() in (b'yes', b'y'))   # → True
print(b'abc'.upper())   # → b'ABC'

See also

Open in the full glossarydocs.python.orgReport an inaccuracy