Python bytearray() Class

The bytearray() class is used to return a bytearray object which is an array of the specified bytes. It gives a mutable sequence of integers in the range 0 <= x < 256.

Syntax

Parameter

source[optional]: This parameter is used to Initialize the given array of bytes.

encoding[optional]: This parameter encoding the specified string.

errors[optional]: The error parameter takes action when encoding fails.

Return

It returns an array of bytes of the specified size.

Example 1

Output

Pin It on Pinterest

Share This