[Tutor] Best method for filtering lists in lists...

Alan Gauld alan.gauld at btinternet.com
Sat Dec 16 02:40:09 CET 2006


"Chris Hengge" <pyro9219 at gmail.com> wrote

> I'm terming a redundant list just like I posted in the original 
> message:
> [[1,2,3], [4,5,6],[1,2,3]]
>
> [0][0] and [0][2] are redundant, so I only want to keep one of them.

In that case put the inner lists in a Set. That will eliminate 
duplicates.

I actually read you intial post as meaning you wanted to flatten
the list, as in [1,2,3,4,5,6,1,2,3,....] Just as well you clarified! 
:-)

Alan G. 




More information about the Tutor mailing list