摘要:
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] (不是我 阅读全文
摘要:
def extendList(val, list=[]): list.append(val) return list list1 = extendList(10) list2 = extendList(123,[]) list3 = extendList('a') print "list1 = %s 阅读全文