I am trying to read a 16-bit binary file in python3 and I'm getting the following error
out = struct.unpack("h", bytes)
error: unpack requires a buffer of 2 bytes
import struct
for line in file_read:
bytes = file_read.read(2)
out = struct.unpack("h", bytes)
file_write.write(str(out))
any suggestion on where i might be going wrong will be much appreciated..