Do you mean append
?
>>> x = [1,2,3]
>>> y = [4,5,6]
>>> x.append(y)
>>> x
[1, 2, 3, [4, 5, 6]]
Or merge?
>>> x = [1,2,3]
>>> y = [4,5,6]
>>> x + y
[1, 2, 3, 4, 5, 6]
>>> x.extend(y)
>>> x
[1, 2, 3, 4, 5, 6]
More Related Contents:
- What is the difference between Python’s list methods append and extend?
- Append cumulative list of lists python
- Why does append() always return None in Python? [duplicate]
- Python append() vs. + operator on lists, why do these give different results?
- Why does foo.append(bar) affect all elements in a list of lists?
- Appending item to lists within a list comprehension
- Appending a dictionary to a list in a loop
- How can I find same values in a list and group together a new list?
- Python extend with an empty list bug? [duplicate]
- How to allow list append() method to return the new list
- Is there a way to circumvent Python list.append() becoming progressively slower in a loop as the list grows?
- What’s the difference between plus and append in python for list manipulation? [duplicate]
- Python The appended element in the list changes as its original variable changes
- How to make a dict from n’th indices of tuples in list
- How do I concatenate items in a list to a single string?
- Why does this iterative list-growing code give IndexError: list assignment index out of range?
- Slicing a list in Python without generating a copy
- Python list doesn’t reflect variable change
- How can I multiply all items in a list together with Python?
- In Python, what is the fastest algorithm for removing duplicates from a list so that all elements are unique *while preserving order*? [duplicate]
- merging Python dictionaries
- Accessing the list while being sorted
- Modifying a list inside a function
- How does the max() function work on list of strings in python?
- Python: How to remove empty lists from a list? [duplicate]
- How to get the n next values of a generator in a list (python)
- How do I sort this list in Python, if my date is in a String?
- Convert all strings in a list to integers
- How do I send list of dictionary as Body parameter in FastAPI?
- Python Sort One List According to Another List