Break up list into groups
marduk
marduk at nbk.hopto.org
Mon Jul 16 17:56:06 EDT 2007
On Mon, 2007-07-16 at 16:31 -0500, marduk wrote:
> Assuming you meant '0xF0' instead of '0x80'.... do you mean any value
> >=240 starts a new group? If so:
>
> groups = []
> current = [] # probably not necessary, but as a safety
> for i in l:
> if i >= 240:
> current = []
> groups.append(current)
> current.append(i)
>
>
Misunderstood... actually that should have read
groups = []
current = [] # probably not necessary, but as a safety
for i in l:
if 240 & i:
current = []
groups.append(current)
current.append(i)
More information about the Python-list
mailing list