Alan McIntyre wrote:
> Tony,
>
> Actually I only want to remove a certain kind of duplication; <snip>

How about this one liner?
def condense(m):
                    print [m[0]]+[m[k] for k in range(1,len(m)) if
m[k]!=m[k-1]]
b=[1,1,1,2,2,2,1,1,1]
condense(b)
Tony Clarke

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to