dimitarsp

06-08-2012, 02:28 AM

I am trying to find duplicates in relationship and omit them from my list. I have tried nested if statements, but I haven't gotten the right solution yet.

list = [[u'polySurface5.e[4]', u'polySurface5.e[1]', .5], [u'polySurface5.e[8]', u'polySurface5.e[2]', .9], [u'polySurface5.e[1]', u'polySurface5.e[4]', .5], [u'polySurface5.e[2]', u'polySurface5.e[9]', 1.2], [u'polySurface5.e[2]', u'polySurface5.e[2]', 0] ]

in the following list, I want to remove "doubles", and values where that last item is 0. I want to end up with something like this:

newlist = [[u'polySurface5.e[4]', u'polySurface5.e[1]', .5], [u'polySurface5.e[8]', u'polySurface5.e[2]', .9], [u'polySurface5.e[2]', u'polySurface5.e[9]', 1.2] ]

in which way can i compare [u'polySurface5.e[4]', u'polySurface5.e[1]', .5] with [u'polySurface5.e[1]', u'polySurface5.e[4]', .5] and remove any occurrence after the first one?

many thanks!

list = [[u'polySurface5.e[4]', u'polySurface5.e[1]', .5], [u'polySurface5.e[8]', u'polySurface5.e[2]', .9], [u'polySurface5.e[1]', u'polySurface5.e[4]', .5], [u'polySurface5.e[2]', u'polySurface5.e[9]', 1.2], [u'polySurface5.e[2]', u'polySurface5.e[2]', 0] ]

in the following list, I want to remove "doubles", and values where that last item is 0. I want to end up with something like this:

newlist = [[u'polySurface5.e[4]', u'polySurface5.e[1]', .5], [u'polySurface5.e[8]', u'polySurface5.e[2]', .9], [u'polySurface5.e[2]', u'polySurface5.e[9]', 1.2] ]

in which way can i compare [u'polySurface5.e[4]', u'polySurface5.e[1]', .5] with [u'polySurface5.e[1]', u'polySurface5.e[4]', .5] and remove any occurrence after the first one?

many thanks!