I have two lists:
A = [1,2,3]
B = [4,5,6]
Is there an elegant way to insert B into A at an arbitrary position?
Hypothetical output:
[1,4,5,6,2,3]
Obviously I could iterate through B
and insert them one at a time, but I figured there was a better way.
A[1:1] = B
A
will be [1, 4, 5, 6, 2, 3]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With