Python - How to edit hexadecimal file byte by byte

Tony Stark picture Tony Stark · Aug 24, 2009 · Viewed 26.2k times · Source

I want to be able to open up an image file and extra the hexadecimal values byte-by-byte. I have no idea how to do this and googling "python byte editing" and "python byte array" didn't come up with anything, surprisingly. Can someone point me towards the library i need to use, specific methods i can google, or tutorials/guides?

Answer

af. picture af. · Aug 24, 2009

Python standard library has mmap module, which can be used to do exactly this. Take a look on the documentation for further information.