更新时间:2023-02-14 13:35:44
内置函数zip()
几乎可以满足您的要求:
The built-in function zip()
will almost do what you want:
>>> zip(*[(1, 2), (3, 4), (5, 6)])
[(1, 3, 5), (2, 4, 6)]
唯一的区别是您得到的是元组而不是列表.您可以使用
The only difference is that you get tuples instead of lists. You can convert them to lists using
map(list, zip(*[(1, 2), (3, 4), (5, 6)]))