Sunday 27 December 2020

How do I concatenate two lists in Python?

 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]


from : https://stackoverflow.com/questions/1720421/how-do-i-concatenate-two-lists-in-python

No comments:

Post a Comment