Find similar items in list of lists using Python -


I am trying to do something like this, but I am using lists of lists. However, gives me a TypeError.

  list1 = [[a, a], [b, b], [c, c]] list2 = [[c, c], [d, d], [e, e ]] Same = set (list 1) & amp; Set (list2)   

I am also trying to find:

  different = not set (list1) & amp; Set (list2)    

There are no types of lists, so they can not be set You can convert a list to a tube with Tupl (MyList) . The following codes assume that a, b, c, d and e are positive types.

  list1 = [(a, a), (b, b), (c, c)] list2 = [(c, c), (d, d), (e, e )] Equal = set (list 1) & amp; Set (list2)    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -