What is the fastest way to merge two lists in python?

后端 未结 5 468
借酒劲吻你
借酒劲吻你 2020-12-10 10:49

Given,

list_1 = [1,2,3,4]
list_2 = [5,6,7,8]

What is the fastest way to achieve the following in python?

l         


        
5条回答
  •  执笔经年
    2020-12-10 11:31

    list_1 + list_2 does it. Example -

    >>> list_1 = [1,2,3,4]
    >>> list_2 = [5,6,7,8]
    >>> list_1 + list_2
    [1, 2, 3, 4, 5, 6, 7, 8]
    

提交回复
热议问题