Python

Python 内置函数

2020-08-15  本文已影响0人  成功在于实践
内置函数
abs() divmod() input() open() staticmethod()
all() enumerate() int() ord() str()
any() eval() isinstance() pow() sum()
basestring() execfile() issubclass() print() super()
bin() file() iter() property() tuple()
bool() filter() len() range() type()
bytearray() float() list() raw_input() unichr()
callable() format() locals() reduce() unicode()
chr() frozenset() long() reload() vars()
classmethod() getattr() map() repr() xrange()
cmp() globals() max() reverse() zip()
compile() hasattr() memoryview() round() import()
complex() hash() min() set()
delattr() help() next() setattr()
dict() hex() object() slice()
dir() id() oct() sorted() exec 内置表达式
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的区别

https://zhuanlan.zhihu.com/p/36309190

上一篇下一篇

猜你喜欢

热点阅读