I'm trying to read a BMP file in Python. I know the first two bytes
indicate the BMP firm. The next 4 bytes are the file size. When I execute:
fin = open("hi.bmp", "rb") firm = fin.read(2) file_size = int(fin.read(4))
ValueError: invalid literal for int() with base 10: 'F#\x13'
What I want to do is reading those four bytes as an integer, but it seems Python is reading them as characters and returning a string, which cannot be converted to an integer. How can I do this correctly?