Mar-13-2023, 03:21 AM
As mentioned, you append() bytes. Since each element from the bytearray is a byte, that should work fine.
>>> b = bytearray() >>> for x in bytearray(b'abc'): ... b.append(x) ... >>> b bytearray(b'abc')