Find (and keep) duplicates of sublist in python

duplicates, list, python, sublist

Solution

common = set(x[0])
for l in x[1:]:
    common &= set(l)
print list(common)

or:

import operator
print reduce(operator.iand, map(set, x))

Problem

I have a list of lists (sublist) that contains numbers and I only want to keep those exists in all (sub)lists. Example: ``` x = [ [1, 2, 3, 4], [3, 4, 6, 7], [2, 3, 4, 6, 7]] output => [3, 4] ``` How can I do this?

Original source