Sometimes, we want to concatenate two lists in Python.
In this article, we’ll look at how to concatenate two lists in Python.
How to concatenate two lists in Python?
To concatenate two lists in Python, we can use the + operator.
For instance, we write
listone = [1, 2, 3]
listtwo = [4, 5, 6]
joinedlist = listone + listtwo
to combine listone and listtwo into one list and assign the joined list to joinedlist.
listtwo‘s entries will come after listone in joinedlist.
Conclusion
To concatenate two lists in Python, we can use the + operator.