0
What's returns map() and filter()?
I tried to print result of using map or filter function but got error!
7 ответов
+ 7
Theophile, output for "print(map(int, ["2", "3", "10"]))" is "<map object at 0x682e28c>"
+ 2
They return map or filter objects. If you want to get the list, you have to do something like :
list(map(int, liste)) #returns a list
+ 1
Filter is a function that filter an array of a condition made by the programmer, map is to apply a function in the entire array.
Could you show the code to see where is the error?
+ 1
Why i can't print filter or map object?
I want see exactly result of using map or filter function, not the list, that i will get if use list(map or filter)
+ 1
print(map(int, ["2", "3", "10"]))
+ 1
Lothar, thanks
+ 1
you can also iterate over map and filter objects..
for i in map(int, ["2", "3", "10"]):
print(i)
you can also also nest the functions in case you’re dealing with nested iterables😀