map,filter

def is_odd(n):
    return n % 2 == 1

newlist = filter(is_odd, [i for i in range(0,5)])
print(list(newlist))

def sun(x,y):
    return x+y
print(list(map(sun,[2,3,1,2],[6,6,1,2])))

 yield的用法:

很好的一个博客

原文地址:https://www.cnblogs.com/two-peanuts/p/11209431.html