「Python」lambda式を使用するサンプル
環境
Python 3.9.13
Windows 11 Pro 21H2 64bit
PyCharm 2022.2.1 (Community Edition)
構文
lambda 引数: 返り値
lambda式を使用します。
使用例
cft = [11, 22, 33] res = map(lambda s: s*2, cft) print(list(res))
実行結果
[22, 44, 66]
Coding Changes the World
環境
Python 3.9.13
Windows 11 Pro 21H2 64bit
PyCharm 2022.2.1 (Community Edition)
構文
lambda 引数: 返り値
lambda式を使用します。
使用例
cft = [11, 22, 33] res = map(lambda s: s*2, cft) print(list(res))
実行結果
[22, 44, 66]