def split_field(byte_len, data_bytes):
'''
Return a tuple containing the first byte_len bytes in data_bytes, and the
remainder of data_bytes.
Asserts if data_bytes is not at least byte_len bytes long.
'''
assert len(data_bytes) >= byte_len
return (bytearray(data_bytes[0:byte_len]),
bytearray(data_bytes[byte_len:]))
# struct formats. See
# https://docs.python.org/2/library/struct.html#byte-order-size-and-alignment
评论列表
文章目录