标签:列表 round 映射 dba list 练习 匿名 元素 import
items=[1,2,3,4,5] def inc(x): return x+1 list(map(inc,items))
[2, 3, 4, 5, 6]
>>> a = [i+1 for i in range(3)] >>> list(map((lambda x:x+5),a))
>>> list(filter((lambda x:x>1),a))
>>> arr = [i+1 for i in range(4)] >>> reduce((lambda x,y:x*y),arr)
>>> a = [i+1 for i in range(3)] >>> a
[1, 2, 3]
>>> arr = list(filter((lambda x:x%2==0),[i+1 for i in range(5)])) >>> arr
{0: ‘c‘, 1: ‘c‘, 2: ‘c‘}
标签:列表 round 映射 dba list 练习 匿名 元素 import
原文地址:https://www.cnblogs.com/fine-6/p/9022433.html