摘要: li = [1,2,-1,5,-2,6,7] #max(最大的) s1 = max(li,key=lambda x:x) print(s1) #7 #min(最小的) s2 = min(li,key=lambda x:x) print(s2) # -2 #map(映射) s3 = map(lambda x,y:x*y,li,li) print(list(s3)) #[1, 4, 1, 25, 4... 阅读全文
posted @ 2019-09-16 20:28 Primrose 阅读(162) 评论(0) 推荐(0) 编辑
摘要: python高阶函数 python高阶函数有很多,我们这里主要介绍六种常用的高阶函数: lambda()匿名函数,filter()筛选函数,map()函数,reduce()函数,zip()函数 ,sorted()函数 lambda()匿名函数,filter()筛选函数,map()函数,reduce( 阅读全文
posted @ 2019-09-16 08:44 Primrose 阅读(335) 评论(0) 推荐(0) 编辑