0
我是新來的蟒蛇,我已經看到了這幾次:Python的 - 「_」之爭到功能
>>> nums = [1,2,3,4,5]
>>> [(x,y) for x in nums for y in nums]
[(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5)]
>>> min(_, key=lambda pair: pair[0]/pair[1])
(1, 5)
在上面是什麼目的的代碼:將「_」在min函數和還有什麼地方可以使用?
http://stackoverflow.com/questions/5787277/python-underscore-as-a函數參數 – simchona 2012-04-19 16:22:54
[Python下劃線作爲函數參數]的可能重複(http://stackoverflow.com/questions/5787277/python-underscore-as-a-function-parameter) – ShadowRanger 2017-04-19 00:26:32