Home › Forums › Python Programming › "map" in python › Re: “map” in python
January 6, 2014 at 4:25 pm
#1968
Keymaster
In python3 or above, the “return” of map() will be shown as an object: You need to input that to list to see the desired result..
Code:
>>> l = [1,10,100]
>>> m = [2,20,200]
>>> map(lambda x,y: x*y, l,m)
<map object at 0x7f7753fcb790>
>>> list(map(lambda x,y: x*y, l,m))
[2, 200, 20000]
>>>
>>> m = [2,20,200]
>>> map(lambda x,y: x*y, l,m)
<map object at 0x7f7753fcb790>
>>> list(map(lambda x,y: x*y, l,m))
[2, 200, 20000]
>>>