小编典典

如何在 Python 中连接两个列表?

python

如何在 Python 中连接两个列表?

例子:

listone = [1, 2, 3]
listtwo = [4, 5, 6]

预期结果:

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

阅读 402

收藏
2022-01-19

共1个答案

小编典典

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

listone = [1, 2, 3]
listtwo = [4, 5, 6]

joinedlist = listone + listtwo

输出:

>>> joinedlist
[1, 2, 3, 4, 5, 6]
2022-01-19