2013-02-16 56 views

回答

5

嵌套循環的短路List comprehension

>>> l = [[0.1, 0.2], [1.1, 1.2]] 
>>> [[(0, val) for val in elem] for elem in l] 
[[(0, 0.1), (0, 0.2)], [(0, 1.1), (0, 1.2)]] 
+0

完美地工作,謝謝。 – Feles 2013-02-16 21:14:23

+0

@ Feles。別客氣 :) – 2013-02-16 21:14:53

相關問題