摘要: def multipliers(): return [lambda x : i * x for i in range(4)] print [m(2) for m in multipliers()] #执行结果: [6, 6, 6, 6] 说明: 上面代码输出的结果是[6, 6, 6, 6] (不是我 阅读全文
posted @ 2022-08-17 00:14 Avicii_2018 阅读(19) 评论(0) 推荐(0) 编辑
摘要: def extendList(val, list=[]): list.append(val) return list list1 = extendList(10) list2 = extendList(123,[]) list3 = extendList('a') print "list1 = %s 阅读全文
posted @ 2022-08-17 00:08 Avicii_2018 阅读(20) 评论(0) 推荐(0) 编辑