Python bytearray()

bytearray() method returns a bytearray object which is an array of given bytes.

prime = [2, 3, 5, 7]

print(bytearray(prime))

$ python3 test.py
bytearray(b’\x02\x03\x05\x07′)

0 <= x < 256 の整数