一、内置函数
python内置了一系列的常用函数,以便于我们使用,python英文官方文档详细说明:点击查看, 为了方便查看,将内置函数的总结记录下来。
eval 有返回值,有结果的简单计算
exec 没有返回值,简单的流程
compile 编译用的
code1 = 'for i in range(0,10): print (i)' compile = compile(code1,'','exec') exec(compile)
complex 复数 由实数和虚数组合,例如 5 + 12j 这个组合是复数
divmod 除余方法 divmod(7,2) 7/2 =3 1 结果为(3,1)
reverse 反转
format < 左对齐 >右对其 ^中间对其,后面带数字表示打开多少个空间
zip 拉链方法,以最小的为基准拉起数值
l = [1,2,3,4,5] l2 = ['a','b','c','d','e'] for i in zip(l,l2): print(i) #结果 (1, 'a')(2, 'b')(3, 'c')(4, 'd')(5, 'e')
filter (函数方法,参数值) 参数值执行函数方法