Hey Mark,
Be aware that when you do set(list) you discard the duplicates on the list,
so you may be comparing different things...
by the way, aren't sets deprecated?
Cheers!
Eduardo

On Fri, Nov 21, 2014 at 5:00 AM, Mark Jackson <[email protected]> wrote:

> 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
> <https://groups.google.com/d/msgid/python_inside_maya/CAGQH2FFw7NU0FqAfcaQAwkEkSO_8_ioHc5YUhKiJR_guXmTkwQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Eduardo GraƱa
www.eduardograna.com.ar

-- 
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/CACt6GrnNbB%3Dbebgb%3DEAtNB6a_a9ZC10r2_54fdacOEMhP7An%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to