Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 2 个数组,例如: [1, 2, 3] 和 [4, 5, 6] 如何将它们合并为 1 个数组?:[1, 4, 2, 5, 3, 6] ?请帮忙
如果顺序不重要,可以使用+:
+
a = [1, 2, 3] b = [4, 5, 6] c = a + b
否则,您可以执行以下操作:
a = [1, 2, 3] b = [4, 5, 6] c = [] for i, j in zip(a, b): c += [i, j]