1
這裏是我的情況:覆蓋數組的前n個元素?
a = ["","","","","","","","","",""] #10 elements. Need not always be blank.
b = ["a","b","c","d"]
我想修改a
使得a
第一n
元件用的b
的元素,其中n = b.size()
代替:
a = ["a","b","c","d","","","","","",""]
那麼,有沒有一些簡單的像a.replace(b)
減去截斷?
另一種方法是將a.size() - b.size()
元素數加到b
。