如何在Python中串联两个列表?
问题描述:
如何在Python中连接两个列表?
How do I concatenate two lists in Python?
示例:
listone = [1, 2, 3]
listtwo = [4, 5, 6]
预期结果:
>>> joinedlist
[1, 2, 3, 4, 5, 6]
答
您可以使用+运算符将它们组合:
You can use the + operator to combine them:
listone = [1,2,3]
listtwo = [4,5,6]
joinedlist = listone + listtwo
输出:
>>> joinedlist
[1,2,3,4,5,6]