python 内建函数
zip(x,y,z)
In [1]: x = [1, 2, 3]
In [2]: y = [4, 5, 6]
In [3]: xyz = zip(x, y, z)
xyz
[(1, 4, 7), (2, 5, 8), (3, 6, 9)]
hash:
In [11]: print hash('abc')
1453079729188098211
coding:utf-8
mylist=[1,2,3,4,5,7,5,7,8,8]
def function(n):
return n*2
def myfilter(n):
if n !=0:
return 1
def is_even(x):
return x and 1 != 0
b=map(lambda x:x*2,mylist)
d = reduce(lambda x, y: x + y, [2, 3, 4, 5, 6], 1)
c=filter(is_even,mylist)
print d
浙公网安备 33010602011771号