What is the most efficient way to concatenate two lists list_a
and list_b
when:
list_b
items have to be placed before list_a
items
- the result must be placed in
list_a
I have 4 possibilities in mind:
# 1
list_a = list_b + list_a
# 2
for item in list_b:
list_a.insert(0, item)
# 3
for item in self.list_a:
list_b.append(item)
list_a = list_b
# 4
list_a[0:0] = list_b
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…