map(函数,可以迭代的对象)
# def f1(x):
# if x>2:
# return True
# else:
# return False
# ret = filter(f1,[0,1,2,3,4,5])
# for i in ret:
# print(i)
def f1(x):
return x+100
#ret = map(f1,[1,2,3,4,5])
ret = map(lambda x:x+100,[1,2,3,4,5,6,])
print(ret)
for i in ret:
print(i)
C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\python.exe “C:\Program Files\JetBrains\PyCharm 2017.2\helpers\pydev\pydevd.py” –multiproc –qt-support=auto –client 127.0.0.1 –port 1064 –file C:/Users/Administrator/PycharmProjects/py/recover.py
pydev debugger: process 4952 is connecting
Connected to pydev debugger (build 172.3317.103)
<map object at 0x02E71030>
101
102
103
104
105
106
Process finished with exit code 0