Combine lists by joining strings with matching index values

后端 未结 5 1762
闹比i
闹比i 2021-01-06 11:50

I have two lists that I would like to combine, but instead of increasing the number of items in the list, I\'d actually like to join the items that have a matching index. Fo

5条回答
  •  一向
    一向 (楼主)
    2021-01-06 11:58

    >>> List1 = ['A', 'B', 'C']
    >>> List2 = ['1', '2', '3']
    >>> map(lambda a, b: a + b, List1, List2)
    ['A1', 'B2', 'C3']
    

提交回复
热议问题