擅长:python、mysql、java
<p>如果你想构造和分析二进制文件,struct模块会给你基本的工具,但它不是很友好,特别是如果你想看的东西不是一个完整的字节数。</p>
<p>有几个模块可以提供帮助,例如<a href="http://pypi.python.org/pypi/BitVector" rel="nofollow noreferrer">BitVector</a>、<a href="http://pypi.python.org/pypi/bitarray/" rel="nofollow noreferrer">bitarray</a>和<a href="http://code.google.com/p/python-bitstring/" rel="nofollow noreferrer">bitstring</a>。(我赞成<a href="http://code.google.com/p/python-bitstring/" rel="nofollow noreferrer">bitstring</a>,但我写的,所以可能有偏见)。</p>
<p>对于解析二进制格式,<a href="http://hachoir.org/" rel="nofollow noreferrer">hachoir</a>模块非常好,但我怀疑它对于您当前的需要来说太高了。</p>