#!/usr/bin/env python3
# -*-coding:utf-8-*-
# date: 2018/5/14
__author__ = 'Bing'
LI = [11, 22, 33, 44, 55, 66]
# def f(args):
# result = []
# for i in args:
# result.append(100+i)
# return result
#
#
# print(f(LI))
# map(函数,可迭代的对象(可以for循环的东西))
def f2(a):
return a + 100
result = map(f2, LI)
print(list(result))
result2 = map(lambda a: a + 100, LI)
print(list(result2))
将函数返回值添加到结果中
发表评论
共 0 条评论
暂无评论