Compare tuples of different lenght
Jurgens de Bruin
debruinjj at gmail.com
Sat Aug 20 04:25:18 EDT 2011
Hi,
I have a list of tuples:
[(2,),(12,13),(2,3,4),(8,),(5,6),(7,8,9),]
I would like to compare all the tuples to each other and if one
element if found two tuples the smallest tuples is removed from the
list.
example if tuple 1 and tuple 3 are compare it should find that a
single element in each are the same and tuple 1 should be removed
resulting in
[(12,13),(2,3,4),(8,),(5,6),(7,8,9),]
the same for tuple 4 and 6 resulting in
[(12,13),(2,3,4),(5,6),(7,8,9),]
is this possible as I am having no success.
Thanks
More information about the Python-list
mailing list