In Python, I have two lists
List1 = [1, 2] List2 = [3, 4]
How can I concatenate two lists in Python to get the below result!
List3 = [1, 2, 3, 4]
You have two options to perform merge or concatenate for two lists in Python:
Simply, you can use "+" operator.
list3=list1+list2 #the result is list3=[1, 2, 3, 4]
If you don't need to preserve the first list you can use "extend".
list1.extend(list2)
Hope it helps!
1.1k Activities
696 Answers
483 Comments
193k Users
715 Quest
401 Posts
Related Activities
Categories
Most popular tags