How to Append One List to Another in Python
Daniel Hayes
Full-Stack Engineer · Leapcell

Key Takeaways
append()
adds a list as a single nested element.extend()
and+
operator add elements individually.- Use a loop with
append()
for custom processing.
In Python, lists are versatile data structures that allow you to store collections of items. Often, you may need to combine two lists. Python provides several methods to achieve this, each with its own use cases and behaviors. This article explores these methods in detail.
Using append()
The append()
method adds its argument as a single element to the end of a list. When you use append()
to add a list to another list, the entire list is added as a single element, resulting in a nested list.
Example:
list1 = ['apple', 'banana', 'cherry'] list2 = ['orange', 'grape'] list1.append(list2) print(list1) # Output: ['apple', 'banana', 'cherry', ['orange', 'grape']]
In this example, list2
is appended to list1
as a single element. The resulting list1
contains the original elements followed by list2
as a nested list.
Using extend()
If you want to add elements of one list to another individually, rather than as a single nested list, you can use the extend()
method. This method iterates over its argument and adds each element to the list.
Example:
list1 = ['apple', 'banana', 'cherry'] list2 = ['orange', 'grape'] list1.extend(list2) print(list1) # Output: ['apple', 'banana', 'cherry', 'orange', 'grape']
Here, each element of list2
is added to list1
individually. The extend()
method modifies the original list in place.
Using the +
Operator
Another way to combine lists is by using the +
operator, which concatenates lists and returns a new list.
Example:
list1 = ['apple', 'banana', 'cherry'] list2 = ['orange', 'grape'] combined_list = list1 + list2 print(combined_list) # Output: ['apple', 'banana', 'cherry', 'orange', 'grape']
This method does not modify the original lists but creates a new list containing elements from both.
Using a Loop with append()
You can also use a loop to append each element of one list to another individually.
Example:
list1 = ['apple', 'banana', 'cherry'] list2 = ['orange', 'grape'] for item in list2: list1.append(item) print(list1) # Output: ['apple', 'banana', 'cherry', 'orange', 'grape']
This approach gives you more control over how elements are added, allowing for additional processing if needed.
Choosing the Right Method
- Use
append()
when you want to add the entire second list as a single element, resulting in a nested list. - Use
extend()
or the+
operator when you want to combine lists element-wise. - Use a loop with
append()
when you need to add elements individually with additional processing.
Understanding these methods and their behaviors will help you manipulate lists effectively in Python.
FAQs
append()
adds a list as one item, while extend()
adds each item individually.
No, it returns a new list without altering the originals.
When you need to process or filter elements before appending.
We are Leapcell, your top choice for hosting Python projects.
Leapcell is the Next-Gen Serverless Platform for Web Hosting, Async Tasks, and Redis:
Multi-Language Support
- Develop with Node.js, Python, Go, or Rust.
Deploy unlimited projects for free
- pay only for usage — no requests, no charges.
Unbeatable Cost Efficiency
- Pay-as-you-go with no idle charges.
- Example: $25 supports 6.94M requests at a 60ms average response time.
Streamlined Developer Experience
- Intuitive UI for effortless setup.
- Fully automated CI/CD pipelines and GitOps integration.
- Real-time metrics and logging for actionable insights.
Effortless Scalability and High Performance
- Auto-scaling to handle high concurrency with ease.
- Zero operational overhead — just focus on building.
Explore more in the Documentation!
Follow us on X: @LeapcellHQ