lambda
f=lambda x,y…:exp(x,y…) //like x+y直接定义一个函数,如果调用f(x,y…),等价于获得exp(x,y…)的值
filter
filter(bool_func,[d1,d2,d3…])返回数据序列里面满足bool函数的子序列
map
map(func,[d1,d2,d3…])返回[func(d1),func(d2),func(d3)…]
reduce
reduce(func,data_seq[,init])对序列中元素迭代执行func,即每次取当前计算结果和序列中下一个元素作为执行对象
list comprehension
[expr1 for k in list if expr2]Time counting
import time.clocktime1 = time.clock()
Dosth()
time2 = time.clock()
print (time2-time1)
to be updated…
No comments:
Post a Comment