Python-如何在Python中串联两个列表?

如何在Python中串联两个列表?

例:

listone = [1, 2, 3]

listtwo = [4, 5, 6]

预期结果:

>>> joinedlist

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

回答:

你可以使用+运算符来组合它们:

listone = [1,2,3]

listtwo = [4,5,6]

joinedlist = listone + listtwo

输出:

>>> joinedlist

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

以上是 Python-如何在Python中串联两个列表? 的全部内容, 来源链接: utcz.com/qa/413111.html

回到顶部