How can I get the concatenation of two lists in Python without modifying either one? [duplicate]
Yes: list1 + list2. This gives a new list that is the concatenation of list1 and list2.
Yes: list1 + list2. This gives a new list that is the concatenation of list1 and list2.
a += [”] * (N – len(a)) or if you don’t want to change a in place new_a = a + [”] * (N – len(a)) you can always create a subclass of list and call the method whatever you please class MyList(list): def ljust(self, n, fillvalue=””): return self + [fillvalue] * (n – len(self)) … Read more