python里的map函数用法的代码

在代码过程中中,把代码过程中经常用的一些代码段珍藏起来,下面代码内容是关于python里的map函数用法的代码,应该是对大伙有所用途。

map function

basic syntax

def mul2(x):
testList = [1,2,3,4]
print map(mul2,testList)

map function that has two arguments

def mul(x,y):
print map(mul,[1,2,3,4],testList)

posted @ 2021-10-28 14:45  可爱小星星  阅读(130)  评论(0)    收藏  举报