2
keys = zip([x for x in range(0, 10)], [x for x in range(0, 10)])
print keys
結果(與元組列表):如何使每個元素從列表解析zip()的列表?
[(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9)]
我怎樣才能代替元組的每個元素的列表,?下面的例子不工作:
keys = list(zip([x for x in range(0, 10)], [x for x in range(0, 10)]))
下面的例子不工作,以及:
keys = zip([x for x in range(0, 10)], [x for x in range(0, 10)])
for i in keys:
i = list(i)
print keys