python - I am trying to find the set of lists in a tuple -


for example,

(['2', '3', '5'], ['1', '3', '4', '5']) 

the above should yield numbers 3 , 5

(['1', '2', '4'], ['1', '2']) 

this should give out 1 , 2

(['2', '3', '5'], ['1', '2', '4'], ['2', '3']) 

this, should give out 2, because 2 contained in 3 lists in tuple. if there no set should return empty list

for i,e in enumerate(tup): while index < len(tup):     print(tup[index], tup[index + 1])     index = index + 1 

for have this, not sure how go through tup(tuple) , extract each list find set of each 2 lists , iterate , compare rest of lists in tuple

def intersect(lists):     return list(set.intersection(*map(set, lists))) 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -