我有这个数组:
[160, 177], [162, 169], [163, 169], [166, 173], [166, 176], [166, 177], [169, 176], [169, 177]]
如何将其拆分为2个独立的数组,使其成为:
[160,162,163,166,166,166,169,169]
和
[177,169,169,173,176,177,176,177]
答案 0 :(得分:2)
这应该这样做
l = [[160, 177], [162, 169], [163, 169], [166, 173], [166, 176], [166, 177], [169, 176], [169, 177]]
l1, l2 = zip(*l)