def print_bytes(data):
    """
    Function to visualize byte streams. Split into bytes, print to console.
    :param bs: BYTE STRING
    """
    bs = bytearray(data)
    symbols_in_one_line = 8
    n = len(bs) // symbols_in_one_line
    i = 0
    for i in range(n):
        print(str(i*symbols_in_one_line)+" | "+" ".join(["%02X" % b for b in bs[i*symbols_in_one_line:(i+1)*symbols_in_one_line]])) # for every 8 symbols line
    if not len(bs) % symbols_in_one_line == 0:
        print(str((i+1)*symbols_in_one_line)+" | "+" ".join(["%02X" % b for b in bs[(i+1)*symbols_in_one_line:]])+"\n")
def print_bytes ( data ) : bs = bytearray ( data ) symbols_in_one_line = 8 n = len ( bs ) // symbols_in_one_line i = 0 for i in range ( n ) : print ( str ( i * symbols_in_one_line ) + " | " + " " . join ( [ "%02X" % b for b in bs [ i * symbols_in_one_line : ( i + 1 ) * symbols_in_one_line ] ] ) ) if not len ( bs ) % symbols_in_one_line == 0 : print ( str ( ( i + 1 ) * symbols_in_one_line ) + " | " + " " . join ( [ "%02X" % b for b in bs [ ( i + 1 ) * symbols_in_one_line : ] ] ) + "\n" )
Function to visualize byte streams. Split into bytes, print to console.
    :param bs: BYTE STRING