22.内置函数

网址 https://docs.python.org/zh-cn/3/library/functions.html


# 内置函数
a=[1,2,3]
abs(-1)
all([1,True])# 列表字典集合元素全部为true,返回true
any([1,0,None])#列表字典集合有一个元素为true,返回true
ascii("中国")
bin(100) #返回二进制
bool(0)#[] {}返回数据是否为true or false
bytes("中国","utf-8")
bytearray
callable() #是否可调用
chr(80) #十进制对应的ascii
dict
dir(a)
enumerate(a)
eval()
exec()#执行
filter(lambda x:x>10,[1,2,3,4,5,11,12,31,41])#过滤
frozenset#把集合变成不能修改的
globals()
hash()
hex()
isinstance() #判断数据类型
map(lambda x:x+2,{1,2,4})
max()
min()
next()
oct()
ord()
reversed()
round()
set
sorted()
sum()
zip([1,2,3],["A","b"])


原文地址:https://www.cnblogs.com/xh716/p/11567707.html