‘bytearray’ method take an object and return a Mutable bytes array.
Signature
bytearray([source[, encoding[, errors]]])
byte_array_1.py
even_numbers = [2, 4, 6, 8]
byte_array = bytearray(even_numbers)
print(byte_array)
Output
bytearray(b'\x02\x04\x06\x08')
Previous Next Home
This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here