In Python, the only way I can find to concatenate two lists is list.extend, which modifies the first list. Is there any concatenation function that returns its result without modifying its arguments?

7 s
7

Yes: list1 + list2. This gives a new list that is the concatenation of list1 and list2.

Leave a Reply

Your email address will not be published. Required fields are marked *