Think what you're probably after is the difference call in sets, ie, return the difference between the two sets
diff2 = list(set(rigLs)^set(charLs)) What the minus sign does is a return elements in the first arg that aren't in the second, where as the ^ sign returns the actual difference. That said with your lists I didn't get your results? hope that helps Mark On 21 November 2014 07:40, likage <[email protected]> wrote: > I am trying to find the difference between two lists - charLs and rigLs > but as I tried to use the list and set methods as I found online, it is > giving me very different results. > > In the example below, I should be seeing *female01* and *elderly01* in > the diff1 results but yet I am getting *male01* > Even as I switched around the set, like in diff2, this time round it is > giving the list of the 3 rigs that was in the scene. > > Am I doing anywhere wrong or using the wrong code commands? > > > pubObj = cmds.ls(type = "publishedRef") > rigLs = [] > for item in pubObj: > nameSplit = item.split(':') > rigLs.append(nameSplit[0]) > > grpNode = cmds.ls("SceneGrp", type=grpNode.name()) > check = cmds.objExists("|SceneGrp|characterRig") > charLs = cmds.listRelatives("|SceneGrp|characterRig", c=True) > > # Assumingly the following are the items appended into the list > # rigLs : [u'male01', u'female01', u'elderly01'] > # charLs :[u'male01'] > > diff1 = list(set(charLs)-set(rigLs)) > # Results : [u'male01'] > > diff2 = list(set(rigLs)-set(charLs)) > # Results : [u'male01', u'female01', u'elderly01'] > > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/35777d5c-62d6-4341-880b-9f3e5bd123e5%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/35777d5c-62d6-4341-880b-9f3e5bd123e5%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- ------------------------------------- Mark Jackson CEO / Technical Director red9consultancy.com -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAGQH2FFw7NU0FqAfcaQAwkEkSO_8_ioHc5YUhKiJR_guXmTkwQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
