bytes de impresión de Python
#this will print a string as "list of chars", "list of int" and "list of bytes"
x=" abcdefg "
print (f'x as list of chars { list( x )}')
y = [ (ord(item)) for item in list( x )]
print (f'x as decimals { y }')
z = [ f'{item:x}' for item in y]
print (f'x as bytes { z }')
#output
# x as list of chars [' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', ' ']
# x as decimals [32, 97, 98, 99, 100, 101, 102, 103, 32]
# x as bytes ['20', '61', '62', '63', '64', '65', '66', '67', '20']
ruperto2770