代码示例:(标识:python_ref_map_1)
python_ref_map_1.py
def myfunc(a):
  return len(a)

x = map(myfunc, ('apple', 'banana', 'cherry'))

print(x)

#convert the map into a list, for readability:
print(list(x))
运行结果: