[Solved] Get all pairs from elements in sublists


You can do the following

>>> from itertools import chain
>>> a=[[1,2,3],[4,5],[6]]
>>> b=[]
>>> for index, item in enumerate(a):
...    b.extend([[i, j] for i in item for j in chain.from_iterable(a[index+1:])])
>>> b
[[1, 4],
 [1, 5],
 [1, 6],
 [2, 4],
 [2, 5],
 [2, 6],
 [3, 4],
 [3, 5],
 [3, 6],
 [4, 6],
 [5, 6]]

1

solved Get all pairs from elements in sublists