Answer the question
In order to leave comments, you need to log in
Can't print the bytecode of an .exe file?
I want to print it so that my second program is like an installer and can install one file from which the byte code is needed.
a = open("G:/socket/ani.exe","rb")
b = a.read()
print(b)
Answer the question
In order to leave comments, you need to log in
Well, everything is correct. You are trying to print non-printable characters.
To do this, they came up with hexadecimal codes.
Convert bytes to HEX and enjoy
import binascii
filename = 'test.dat'
with open(filename, 'rb') as f:
content = f.read()
print(binascii.hexlify(content))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question