def func(x):
return x+1
print(list(map(func, [1, 2, 3, 4, 5])))
def func2(x):
return x%2==0
print(list(filter(func2,[1,2,3,4])))
from functools import reduce
def fun3(x,y):
return x+y
print(reduce(fun3, range(0, 10)))
# [2, 3, 4, 5, 6]
# [2, 4]
# 45
【Python常用内置函数介绍】相关文章
1.python中的filter、map、reduce、apply用法总结
https://blog.csdn.net/qq_32618817/article/details/80633848
2.Python常用内置函数介绍【filter,map,reduce,apply,zip】
https://blog.csdn.net/Jerry_1126/article/details/41143579
3.Python中的map,filter,sort,reduce,zip内置函数
https://blog.csdn.net/define_us/article/details/79869784
4.python中的map 、reduce 、filter
https://blog.csdn.net/weixin_40763402/article/details/81977807
5.Python中的super()用法
https://blog.csdn.net/qq_14935437/article/details/81458506
6.isinstance() 和 type() 有什么区别?
https://segmentfault.com/q/1010000000160267
https://stackoverflow.com/questions/1549801/what-are-the-differences-between-type-and-isinstance
7.python中==和is与isinstance()和type()区别
https://blog.csdn.net/ryuhfxz/article/details/82965200
8.python中sorted与sort的区别
网友评论