一道Python面試題

無意間,看到這麼一道Python面試題:以下代碼將輸出什麼? def testFun():    temp = [lambda x : i*x for i in range(4)]    return temp for everyLambda in testFun():    print (everyLambda(2)) 腦中默默一想,這還用說麼,肯定是: 0 2 4 6 最後一看答案,竟然是:
相關文章
相關標籤/搜索