Mar-08-2023, 08:30 PM
Bytearray has a
split()
method, so you can separate by a hex value.>>> a = bytearray(b'hello\x93there\x93'*4) >>> a bytearray(b'hello\x93there\x93hello\x93there\x93hello\x93there\x93hello\x93there\x93') >>> a.split(b'\x93') [bytearray(b'hello'), bytearray(b'there'), bytearray(b'hello'), bytearray(b'there'), bytearray(b'hello'), bytearray(b'there'), bytearray(b'hello'), bytearray(b'there'), bytearray(b'')]