How to split a bytes
object into a list/tuple of constant size objects? Ignore padding. Something like
max_size = 42
def foo(b: bytes):
return [b[i:j] for (i, j) in range(max_size)]
foo(b'a' * 100000)
but working.
The 'list comprehension' part is only because it's concise, readable and efficient. IMHO a for()
loop has been ugly for a decade or two.
Desired output: list[bytes objects of specific length]