How do I concatenate two lists in Python?
Example:
listone = [1, 2, 3]
listtwo = [4, 5, 6]
Expected outcome:
>>> joinedlist
[1, 2, 3, 4, 5, 6]
转载于:https://stackoverflow.com/questions/1720421/how-to-concatenate-two-lists-in-python
How do I concatenate two lists in Python?
Example:
listone = [1, 2, 3]
listtwo = [4, 5, 6]
Expected outcome:
>>> joinedlist
[1, 2, 3, 4, 5, 6]
转载于:https://stackoverflow.com/questions/1720421/how-to-concatenate-two-lists-in-python
You can use the +
operator to combine them:
listone = [1,2,3]
listtwo = [4,5,6]
mergedlist = listone + listtwo
Output:
>>> mergedlist
[1,2,3,4,5,6]