# https://docs.python.org/3/library/functions.html
1. map(function, iterable, ...)
ex) int() 함수에 '1', '2', '3', '4' 를 던저 return 된 값을 a, b, c, d 변수에 담는다.
----------------------------------------------------------------------------------------------------------------------------
>>> a, b, c, d = map(int, "1,2,3,4".split(","))
>>> a
1
>>> b
2
>>> c
3
>>> d
4
2. filter(function, iterable)
ex) 지정된 함수에 iterable type이 각각 True 면 반환한다. 두번째 generator expression방식과 동일한 결과다.
----------------------------------------------------------------------------------------------------------------------------
>>> for i in filter(lambda x : int(x) % 2, "1,2,3,4".split(",")):
print(i)
1
3
>>> for i in [i for i in "1,2,3,4".split(",") if int(i) % 2]:
print(i)
1
3
map, filter
|
2020.03.07 14:37:42
|
2022.04.23 13:26:49
|
335
|
Aiden
Total of Attached file
0.00 Bytes of 0 files
2020.08.23
2020.08.22
2020.04.29
2020.04.28
2020.03.07
2020.02.29
2020.02.16
2020.02.01
2020.02.01
2020.01.24