0

我有 2 个列表,{1,2,3,4,5}并且{a,b,c,d,e}. 我想结束{{1,a},{2,b},{3,c},{4,d},{5,e}}

4

1 回答 1

0

这个怎么样:

l1 = {1, 2, 3, 4, 5};
l2 = {a, b, c, d, e};

Partition[Riffle[l1, l2], 2]
{{1, a}, {2, b}, {3, c}, {4, d}, {5, e}}

或者,您可以尝试

l1 = {1, 2, 3, 4, 5};
l2 = {a, b, c, d, e};

Transpose[{l1, l2}]
{{1, a}, {2, b}, {3, c}, {4, d}, {5, e}}
于 2013-04-16T00:06:32.143 回答