在代码过程中中,把代码过程中经常用的一些代码段珍藏起来,下面代码内容是关于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)
在代码过程中中,把代码过程中经常用的一些代码段珍藏起来,下面代码内容是关于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)
本文标题:python里的map函数用法的代码
本文链接:https://www.haomeiwen.com/subject/qgdvaltx.html
网友评论