Simple Ways To Merge Two Lists in Python Without Overcomplicating It

Advertisement

Jun 04, 2025 By Tessa Rodriguez

Working with lists in Python is pretty common. Whether pulling data from APIs, combining inputs from different users, or just reorganizing things in a script, you'll eventually need to merge two lists. The idea is simple: take items from two lists and put them into one. But being flexible, Python gives you many ways to do it. Some are fast and clean, others give you more control. This article breaks down the main methods to merge lists, explains what each does, and when you might pick one over the other. No fluff—just practical stuff that helps you write better Python.

How To Merge Two Lists in Python?

Using the + Operator

This is probably the first method most people come across. You just use the + symbol to combine two lists.

list1 = [1, 2, 3]

list2 = [4, 5, 6]

merged = list1 + list2

print(merged) # [1, 2, 3, 4, 5, 6]

The original lists haven't changed. A new list is returned, so it's safe if you don't want to mess with your original data.

Using .extend() Method

The extend() method is used when you want to add all items from one list to another. Unlike +, it modifies the list in place.

list1 = [1, 2, 3]

list2 = [4, 5, 6]

list1.extend(list2)

print(list1) # [1, 2, 3, 4, 5, 6]

This is memory-efficient since it doesn’t make a new list but changes the first list. Use this if you don’t need to keep the original version.

Using * Unpacking

This method unpacks the elements of each list into a new one using the * operator inside square brackets.

list1 = [1, 2, 3]

list2 = [4, 5, 6]

merged = [*list1, *list2]

print(merged) # [1, 2, 3, 4, 5, 6]

It’s concise and clean. Good for cases where you want readability and a new list without touching the originals.

Using itertools.chain()

Itertools.chain() from the itertools module is useful for longer or more complex merges. It's efficient and lazy—it creates an iterator that only evaluates items as needed.

from itertools import chain

list1 = [1, 2, 3]

list2 = [4, 5, 6]

merged = list(chain(list1, list2))

print(merged) # [1, 2, 3, 4, 5, 6]

Best if you're dealing with large data and want to save memory. It’s more advanced, but worth knowing.

Using a Loop

This is the more manual way. You just loop through the second list and add each item to the first.

list1 = [1, 2, 3]

list2 = [4, 5, 6]

for item in list2:

list1.append(item)

print(list1) # [1, 2, 3, 4, 5, 6]

It's not fancy, but it works. If you're doing more than merging—like filtering or modifying items—a loop gives you more control.

Using List Comprehension

This method gives you a new list using a single expression. It’s great when you want to do something extra while merging.

list1 = [1, 2, 3]

list2 = [4, 5, 6]

merged = [item for item in list1] + [item for item in list2]

print(merged) # [1, 2, 3, 4, 5, 6]

You can also add logic:

merged = [item for item in list1 + list2 if item % 2 == 0]

print(merged) # [2, 4, 6]

Good when you want to filter or tweak while merging.

Using sum()

This trick is not always recommended, but it's still an option. You can "sum" a list of lists using sum() with an empty list as the starting point.

lists = [[1, 2], [3, 4], [5, 6]]

merged = sum(lists, [])

print(merged) # [1, 2, 3, 4, 5, 6]

For just two lists, it’s overkill:

merged = sum([[1, 2, 3], [4, 5, 6]], [])

It's not the most efficient for large lists but works when merging many small ones.

Using numpy.concatenate() (if you're working with numbers)

This method is fast and straightforward if you're doing numerical work and using NumPy.

import numpy as np

list1 = np.array([1, 2, 3])

list2 = np.array([4, 5, 6])

merged = np.concatenate((list1, list2))

print(merged) # [1 2 3 4 5 6]

This returns a NumPy array, not a regular Python list. It’s useful if you’re doing number crunching and performance matters.

Using functools.reduce()

The reduce() function from the functools module can merge lists by repeatedly applying a function. It's usually used for calculations, but you can apply it to list merging too. When you have many lists and want to join them into one, reduce() does the job cleanly.

from functools import reduce

lists = [[1, 2], [3, 4], [5, 6]]

merged = reduce(lambda x, y: x + y, lists)

print(merged) # [1, 2, 3, 4, 5, 6]

It’s useful when you’re working with many lists and prefer a functional approach.

Using operator.iconcat()

iconcat() is a function from the operator module that works like += for lists. It modifies the first list and adds items from the second. It's faster than + because it avoids making a copy.

import operator

list1 = [1, 2, 3]

list2 = [4, 5, 6]

operator.iconcat(list1, list2)

print(list1) # [1, 2, 3, 4, 5, 6]

Use this if you already use the operator module or need fast in-place merging without .extend().

Conclusion

Python gives you many ways to merge lists. If you want something quick and clean, use + or unpacking. Extend () or itertools.chain() if you care about memory or performance. For special cases, like working with numbers or wanting to filter on the fly, try NumPy or list comprehensions. None of these methods are wrong—they just serve different needs. Choose based on what you're doing, whether it's speed, clarity, or flexibility. Once you've tried them a few times, you'll get a feel for which fits best in your workflow. Python's simplicity is in giving you the tools and letting you pick how you want to work.

Advertisement

You May Like

Top

Simple Ways To Merge Two Lists in Python Without Overcomplicating It

Looking for the best way to merge two lists in Python? This guide walks through ten practical methods with simple examples. Whether you're scripting or building something big, learn how to combine lists in Python without extra complexity

Jun 04, 2025
Read
Top

OpenAI Reinstates Sam Altman as CEO: What Challenges Still Lie Ahead

Sam Altman returns as OpenAI CEO amid calls for ethical reforms, stronger governance, restored trust in leadership, and more

Jun 18, 2025
Read
Top

Understanding the Difference Between SQL and PL/SQL

Discover a clear SQL and PL/SQL comparison to understand how these two database languages differ and complement each other. Learn when to use each effectively

Sep 24, 2025
Read
Top

How Snowflake's Neeva Acquisition Enhances Generative AI Capabilities

Snowflake's acquisition of Neeva boosts enterprise AI with secure generative AI platforms and advanced data interaction tools

Jun 13, 2025
Read
Top

How to Install and Configure Apache Flume for Streaming Log Collection

Learn how to install, configure, and run Apache Flume to efficiently collect and transfer streaming log data from multiple sources to destinations like HDFS

Jul 06, 2025
Read
Top

Google's AI-Powered Search: The Key to Retaining Samsung's Partnership

Google risks losing Samsung to Bing if it fails to enhance AI-powered mobile search and deliver smarter, better, faster results

Jun 02, 2025
Read
Top

CES 2025: Hyundai and Nvidia’s AI Vision for Next-Gen Mobility

At CES 2025, Hyundai and Nvidia unveiled their AI Future Mobility Program, aiming to transform transportation with smarter, safer, and more adaptive vehicle technologies powered by advanced AI computing

Aug 20, 2025
Read
Top

How Wearable Tech and AI Anticipate Your Emotional Shifts

How a machine learning algorithm uses wearable technology data to predict mood changes, offering early insights into emotional well-being and mental health trends

Sep 10, 2025
Read
Top

Boost Productivity: How to Use ChatGPT for Google Sheets in Everyday Tasks

How to use ChatGPT for Google Sheets to automate tasks, generate formulas, and clean data without complex coding or add-ons

May 31, 2025
Read
Top

Understanding the Role of ON in SQL Joins

Struggling to connect tables in SQL queries? Learn how the ON clause works with JOINs to accurately match and relate your data

May 17, 2025
Read
Top

SmolAgents Gain Sight for Smarter Real-World Actions

Can small AI agents understand what they see? Discover how adding vision transforms SmolAgents from scripted tools into adaptable systems that respond to real-world environments

May 12, 2025
Read
Top

10 Clever Ways To Use ChatGPT For Analyzing and Summarizing Documents For Free

Discover ten easy ways of using ChatGPT to analyze and summarize complex documents with simple ChatGPT prompts.

Jun 09, 2025
Read