What is the best way to do Bit Field manipulation in Python?
        Posted  
        
            by ZebZiggle
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ZebZiggle
        
        
        
        Published on 2008-09-02T14:28:40Z
        Indexed on 
            2010/05/25
            11:21 UTC
        
        
        Read the original article
        Hit count: 266
        
I'm reading some MPEG Transport Stream protocol over UDP and it has some funky bitfields in it (length 13 for example). I'm using the "struct" library to do the broad unpacking, but is there a simple way to say "Grab the next 13 bits" rather than have to hand-tweak the bit manipulation? I'd like something like the way C does bit fields (without having to revert to C).
Suggestions?
© Stack Overflow or respective owner