On máj. 29, 18:26, Mensanator <[EMAIL PROTECTED]> wrote: > On May 29, 9:42�am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > > > > Hello, > > > I'm tring to make a cutting script. > > The problem is the following, i have a sample pattern, for > > example :'11101110' (0xEE) > > That is the sign of the data begining. > > How can i cut a file if the byte stepping is not the same, for > > example: > > > file=open('test.bin','rb') > > data=file.read() > > print binascii.hexlify(data) � � � � � �# BB9A (1011101110011010) > > file.close() > > > so i need to cut the first two bit and start to writeout the bit > > stream to another file > > If somebody have an idea to do this, please share with me. > > Thanx > > Cutting off the leading two bits isn't a problem, > but once you write out the byte 11101110 you are > left with 011010 which cannot be written as it's not > a byte. How do you plan to handle that? Add two bits > at the MSB (00011010) or two bits at the LSB (01101000) > or discard the fractional byte? > > And do you always know what the bit offset is or > do you have to search for the 11101110 starting > pattern? > Thank's for the reply, Yes, I have to search for the pattern, the bit offset not always the same. for another thing, it's ok if i can fill up with zero at the LSB or discard that byte. (the last byte not important)
Rew -- http://mail.python.org/mailman/listinfo/python-list