How to zip two lists of lists in Python?

前端 未结 5 894
星月不相逢
星月不相逢 2020-12-09 09:19

I have two lists of lists that have equivalent numbers of items. The two lists look like this:

L1 = [[1, 2], [3, 4], [5, 6]]

L2 =[[a, b], [c, d], [e, f]]
         


        
5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-09 09:54

    L1 = [[1, 2], [3, 4], [5, 6]]
    L2 =[[a, b], [c, d], [e, f]]
    
    Lmerge = [x + y for x, y in zip(L1, L2)]
    [[1, 2, 'a', 'b'], [3, 4, 'c', 'd'], [5, 6, 'e', 'f']]
    

提交回复
热议问题