How to insert multiple elements into a list?
To extend a list, you just use list.extend. To insert elements from any iterable at an index, you can use slice assignment… >>> a = list(range(10)) >>> a [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> a[5:5] = range(10, 13) >>> a [0, 1, 2, 3, 4, 10, 11, 12, 5, 6, … Read more