Python one-line “for” expression

后端 未结 6 1054
独厮守ぢ
独厮守ぢ 2020-12-08 03:55

I\'m not sure if I need a lambda, or something else. But still, I need the following:

I have an array = [1,2,3,4,5]. I need to put this array, for insta

6条回答
  •  死守一世寂寞
    2020-12-08 04:51

    If you really only need to add the items in one array to another, the '+' operator is already overloaded to do that, incidentally:

    a1 = [1,2,3,4,5]
    a2 = [6,7,8,9]
    a1 + a2
    --> [1, 2, 3, 4, 5, 6, 7, 8, 9]
    

提交回复
热议问题