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)]
我需要取所有元组的交集并将它们合并。
The desired result = [{92, 242},{355, 403,436,489},{515, 517,859,701,775,634}]
这意味着要将交集的元组进行迭代联合。
我尝试将元组转换为集合并取交集,但没有成功。有什么想法吗?