Python: Seeing all files in Hex

后端 未结 3 483
说谎
说谎 2021-01-28 11:10

I am writing a python script which looks at common computer files and examines them for similar bytes, words, double word\'s. Though I need/want to see the files in Hex, ande c

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-28 11:28

    You can read a set number of bytes by passing an integer argument to read:

    32bits = file.read(4)
    

    You can seek to a position in the file using seek:

    file.seek(100) # Seeks to byte 100
    

提交回复
热议问题