Você está na página 1de 1

'''

resp = valor em "bytes"

(se vier de bytes, acrescente isso:)


hex_string = hex(int(resp,16))
(Fim. Saltar para a instrução 4)

hex_string = "0x616263"[2:]
Slice string to remove leading `0x`

bytes_object = bytes.fromhex(hex_string)
Convert to bytes object

ascii_string = bytes_object.decode("ASCII")
Convert to ASCII representation

print(ascii_string)
Output: abc
'''
#Ou usar o abaixo

'''
>>> import binascii
>>> binascii.hexlify('foo'.encode('utf8'))
b'666f6f'
>>> binascii.unhexlify(_).decode('utf8')
'foo'
'''

Você também pode gostar