[Solved] How to merge two list of list in python


You may achieve this using itertool.chain() with list comprehension expression as:

>>> a=[[1,2,3],[4,5,6]]
>>> b=[[5,8,9],[2,7,10]]

#               v  join the matched sub-lists
#               v                       v  your condition 
>>> [i + list(chain(*[j[1:] for j in b if i[1]==j[0]])) for i in a]
[[1, 2, 3, 7, 10], [4, 5, 6, 8, 9]]

solved How to merge two list of list in python