I have a list of tuples like this :
all_tuples=[(92, 242),(355, 403),(355, 436),(355, 489),(403, 436),(436, 489),(515, 517),(517, 859),(634, 775),(701, 859),(775, 859)]
and I need to take the intersection of all tuples and union them.
The desired result = [{92, 242},{355, 403,436,489},{515, 517,859,701,775,634}]
That is the intersected tuples are union iteratively.
I tried to convert the tuples to sets and then take the intersection but did not work. Any idea?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…