Manipulating binary data in Python

前端 未结 7 1481
旧时难觅i
旧时难觅i 2021-02-07 07:16

I am opening up a binary file like so:

file = open(\"test/test.x\", \'rb\')

and reading in lines to a list. Each line looks a little like:

7条回答
  •  佛祖请我去吃肉
    2021-02-07 07:36

    Like theatrus mentioned, ord and hex might help you. If you want to try to interpret some sort of structured binary data in the file, the struct module might be helpful.

提交回复
热议问题