54.python filter map lambda list配合使用

 

f __name__ == '__main__':

    print('test211')
    alist = [1,2,3,4,5,6,7,8,9]
    blist = list(filter((lambda x:x%2==0),alist))
    print(blist)

    clist = list(map((lambda x:x*2),alist))
    print(clist)
    import sys
    sys.exit()

 

posted @ 2024-01-09 08:42  txwtech  阅读(4)  评论(0编辑  收藏  举报