Commit 1d18460a authored by Alexandre's avatar Alexandre
Browse files

Display data length with debug option

parent 9ce5a4e7
......@@ -20,6 +20,7 @@ re_host = re.compile(r'^([0-9a-z][0-9a-z-\.]*)|([0-9:]+)|([0-9\.])$')
def dump_data(data, text="data"):
pref = ' ' * (len(text) - 4)
print('length:', len(data))
print(f'{text}: ', data)
print(pref, 'hex:', " ".join(format(c, '02x') for c in data))
print(pref, 'bin:', " ".join(format(c, '08b') for c in data))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment