A
A
Alexey Denisov2020-08-12 15:58:56
Python
Alexey Denisov, 2020-08-12 15:58:56

How to read and convert a binary file?

Tell me how you can convert a binary file, such content: 49464F524D414454494F4E

file = open( 'data.log' ,  'rb')
data = file.read()
print(data)
So that the output to the console is the same, without additional characters and conversion to ASCII codes :
49464F524D414454494F4E letters 4 and F, and so on

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ScriptKiddo, 2020-08-12
@Denisov80

with open('data.log', 'rb') as f:
    hexdata = f.read().hex()

https://stackoverflow.com/a/34687617

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question