I want to read a file that has hex. For example the file contains this "\x70\x79\x74\x68\x6f\x6e\x70\x79\x74\x68\x6f\x6e\x70\x79\x74\x68\x6f\x6e"
.
I tried to read the file and print it but when I print it I see the same hex code and not the plaintext English. But when I manually copy the hex code into the print()
function of Python, it shows the plaintext English.
However, the print()
function in the below function only shows the hex code and not English.
with open('sample_hex_file_2.txt', 'r') as f:
data = f.read()
print(data)
I want to read the file that contains the hex code and convert it into English and print it on screen.