함수 map()

Jmnote (토론 | 기여)님의 2014년 8월 22일 (금) 09:30 판 (→‎Python)
map

1 Python

Python 3
numbers = [1, 2, 3, 4, 5, 6]
print( list(map(lambda x: x * 2 - 1, numbers)) )
# [1, 3, 5, 7, 9, 11]
numbers = [1, 2, 3, 4, 5, 6]
print( [x * 2 - 1 for x in numbers] )
# [1, 3, 5, 7, 9, 11]

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}