Python Built-in Functions
---恢复内容开始---
Built-in functions
all()
bool()
callable()
chr() #返回ascii码的对应表
ord() #输入ascii码,返回字母,或者inverse()
compile() #用于代码编译过程
dir() #显示内置function
divmod(5,2) #显示商和余数
eval()字符串到字典
filter(lambda n:n>5,range(10))#过滤器,打印0到9中打印大于5的数据
map(lambda n:n*n,range(10))#[ i*i for i in rang(10)]
reduce() #import functools, functools.reduce( lambda 2,y:x+y,range(10)) 累积10次
globals() #反应当前程序中所有的变量的values
hash()
locals() --函数内的参数显示
pow()幂计算
sorted() #案例print (sorted(a.items(),key = lambda x:x[1])) 对于a字典中的value进行排序
__import__()
浙公网安备 33010602011771号