Re: “map” in python

Home Forums Python Programming "map" in python Re: “map” in python

#1968
Humble
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]
>>>