리스트에 동일한 함수 효과를 주고 싶을 때 map 함수를 사용한다.
예를 들어
def square(x): return x*x lst = [1,2,3,4,5,6,7,8,9] print map(square, lst)
결과는
'Python' 카테고리의 다른 글
[python] 직접 만든 module import 시 import 한 클래스에 파일을 로드할 시 주의! (0) | 2014.10.20 |
---|---|
[Python] PyQt 튜토리얼 (0) | 2014.10.08 |
[python]python file download (0) | 2014.09.25 |
Crawler Class Sample (0) | 2014.09.25 |
List 필터링(Filtering) (0) | 2014.09.24 |