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 questions
679 answers
459 comments
193k users
Related Activities
Categories
Most popular tags