Getting bytes using set stride.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chrrox
    New Member
    • Nov 2013
    • 1

    Getting bytes using set stride.

    I have a byte array
    b'\x00\x01\x02\ x03\x04\x05\x06 \x07\x08\x09\x0 A`'
    what i am trying to do is get lets say 2 values starting at x position every 4 bytes
    so the new byte array would be
    so if my position was 0 in the stride and I want 2 bytes and the stride is 4 this would be the end result
    b'\x00\x01\x04\ x05\x08\x09'

    basically I want to do this
    a[start:end:step]
    but i want to grab more then 1 byte with the step.
Working...