-
l = ['Mon', 'tue', 'Wed', 'Thu', 'fri', 'sat', 'Sun'] def change_words(words, func): for word in words: print(func(word)) def sample_func(word): return word.capitalize() # sample_func = lambda word: word.capitalize() # 마치 scala 의 map 처럼 처리? change_words(l, sample_func) change_words(l, lambda word: word.capitalize()) ''' Mon Tue Wed Thu Fri Sat Sun '''
'python > 기본' 카테고리의 다른 글
Namespace & Scope (0) 2022.04.29 Generator (0) 2022.04.29 Decorator / contextmanager (0) 2022.04.29 Closure (0) 2022.04.29 Function, kwargs (0) 2022.04.29