This might seem pretty stupid, but I'm a complete newbie in python.
So, I have a binary file that starts by
ff d8 ff e0 00 10 4a
(as seen both through Hex Editor Neo and a java program)
yet, when I tried to read it with python by
with open(absolutePathInput, "rb") as f:
while True:
current_byte = f.read(1)
if(not current_byte):
break
print(hex(current_byte[0]))
I get
ff d8 ff e0 0 10 31
It seems that it goes wrong whenever the first 0x00 is readen.
what am I doing wrong? Thank u!
0instead of00? (It should be printing0xin front of all these hex representations, and it should be printing them on separate lines; it looks like you edited the output. Please don't do that.)