python里的map函数用法的代码
2021-10-28 本文已影响0人
we1212
在代码过程中中,把代码过程中经常用的一些代码段珍藏起来,下面代码内容是关于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)