最简单的方法是不
bars通过不同的功能,而直接从
maptest以下位置访问它:
foos = [1.0,2.0,3.0,4.0,5.0]bars = [1,2,3]def maptest(foo): print foo, barsmap(maptest, foos)
使用原始
maptest函数,您还可以在
map以下代码中使用lambda函数:
map((lambda foo: maptest(foo, bars)), foos)
欢迎分享,转载请注明来源:内存溢出
最简单的方法是不
bars通过不同的功能,而直接从
maptest以下位置访问它:
foos = [1.0,2.0,3.0,4.0,5.0]bars = [1,2,3]def maptest(foo): print foo, barsmap(maptest, foos)
使用原始
maptest函数,您还可以在
map以下代码中使用lambda函数:
map((lambda foo: maptest(foo, bars)), foos)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)