2021-07-28

Python: how can I find matches in a set of lists?

I have seen several similar questions and checked them all, but there is no answer for my purpose in any of them.(

Suppose in input I get a list from lists. [[1,2], [1,4], [3,6], [3,8]]

I need to get matches in the output, but not all in one list. For example, 1 lies in the list [1,2] and also in the list [1,4]. I want to get [1,2,4] And the same for 3.

That is, the result should be something like:

(1,2,4)
(3,6,8)

Is it possible?



from Recent Questions - Stack Overflow https://ift.tt/3iXbRNI
https://ift.tt/eA8V8J

No comments:

Post a Comment