本文实例讲述了python处理二进制数据的方法。分享给大家供大家参考。具体如下: #!/usr/env/env python #-*- coding: cp936 -*- ''''' add Head Infomation for pcm file ''' import sys import struct import os __author__ = 'bob_hu, hewitt924@gmail.com' __date__ = 'Dec 19,2011' __update__ = 'Dec 19,2011' def geneHeadInfo(sampleRate,bits,sampleN