Question (Issue)
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]
Now we will see solution for issue: How do I concatenate two lists in Python?
Answer (Solution)
Use the +
operator to combine the lists:
listone = [1, 2, 3]
listtwo = [4, 5, 6]
joinedlist = listone + listtwo
Output:
>>> joinedlist
[1, 2, 3, 4, 5, 6]
This question is answered By – Daniel G
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0