How do I concatenate two lists in Python?
(如何在Python中串联两个列表?)
Example:
(例:)
listone = [1, 2, 3] listtwo = [4, 5, 6]
Expected outcome:
(预期结果:)
>>> 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
Output:
(输出:)
>>> joinedlist [1,2,3,4,5,6]
1.4m articles
1.4m replys
5 comments
57.0k users