"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > I can't seem to find an answer to this question anywhere, but I'm > still looking. My problem is I have a list of values like this: > > l = [0xF0, 1, 2, 3, 0xF0, 4, 5, 6, 0xF1, 7, 8, 0xF2, 9, 10, 11, 12, > 13, 0xF0, 14, 0xF1, 15] > > A value with bit 0x80 set delineates the start of a new packet of > information. What I want to do is to group the packets so that 1, 2, 3 > go with the 1st packet tagged 0xF0, 4 ,5, 6 go with the 2nd packet > tagged 0xF0, 7 & 8 go with the packet tagged 0xF1 and so on. The > length of the data associated with each tag can vary. I've already > written an algorithm to do this but I was wondering if some > combination of itertools functions could do the job faster?
See: http://groups.google.com/group/comp.lang.python/msg/2410c95c7f3b3654 -- http://mail.python.org/mailman/listinfo/python-list