0

I am looking to try and break this incoming byte string into the small number of 10 byte parts as I can for resending. I have looked everywhere but I believe that the answer is to simple and I have simply overlooked it.

Here is an example of what I am printing to the terminal b'\xd3\x00\x16E\xd0\x00q\\x1d\xf6?\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0ff\r'

I am looking to do this in python . the size of these msgs will vary so I need to make it the smallest amount of parts possible at any time in 10 byte pieces.

Thanks in advance

TG

  • If it's a stream, just continually do `stream.read(10)` until the stream is finished. If it's a bytes object, see https://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks (Which applies to iterables like bytestrings) – Artyer Jan 05 '18 at 13:04
  • Thanks for the fast response it is a Bytes class. I currently have it as a variable in my python script but I am looking to chop it up into 10 byte pieces. When I do the mentioned link the sizes seem to come out different, due to length operator I believe. – Team Autonautics Jan 05 '18 at 13:14

0 Answers0