The lower() method of bytearray class in Python

The lower() method of the bytearray class in Python translates the byte values of uppercase ASCII characters into lowercase ASCII values and returns the new object.

Bytearray Updated 12 Nov 2025 1 min read

Overview

  • The lower() method of bytearray class creates a lowercase version of the bytearray contents and returns it. The method does not change the bytearray in-place. A bytearray in Python can hold ASCII and the bytes corresponding to values up-to 255. The uppercase ASCII values are translated to lowercase ones in the new bytearray.

The lower() method of bytearray in Python

  • If the use case is to get the lowercase copy of a Unicode sequence, the lower() method of the Python string class can be used. A string in Python is a mutable sequence of Unicode codepoints with a specified encoding.

Example

python
# Example Python program that converts

            # a bytearray containing ASCII values to

            # corresponding uppercase values

# Create a mutable sequence of ASCII values

            buffer = bytearray(b"HOW LONG IS FOREVER")

            print(buffer)

# Convert uppercase from lowercase values

            translated = buffer.lower()

            print(translated)

Output

Output
bytearray(b'HOW LONG IS FOREVER')

            bytearray(b'how long is forever')