匿名函数,map,reduce,filter
from functools import reduce
a =map(lambdax: x*2, [1,2,3,4,5])
print(list(a))
b = reduce(lambdax, y: x*y, [1,2,3,4,5])
print(b)
c =filter(lambdax: x>4, [1,2,3,4,5,6])
print(list(c))
字符串代码执行
str ='''
def func():
print('aa')
func()
'''
# exec(str)
py_obj =compile(str,"err.log","exec")
exec(py_obj)