我有两个清单,list1
and list2
.
Here len(list2) << len(list1)
.
现在我想合并两个列表,以便每个第 n 个元素最终名单是from list2
and 其他人来自list1
.
例如:
list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
list2 = ['x', 'y']
n = 3
现在最终的列表应该是:
['a', 'b', 'x', 'c', 'd', 'y', 'e', 'f', 'g', 'h']
什么是最Pythonic实现这个目标的方法?
我想添加所有元素list2
到最终列表,最终列表应包含来自list1
and list2
.