lambda(ラムダ) filter (map,if)で条件に合うものを抽出 2017年11月28日 by 河副 太智 Leave a Comment 例1 a = [1, -2, 3, -4, 5] list(filter(lambda x: x>0, aaa)) #xはこの場限りの変数aaaはフィルターしたい文字の入った変数 #変数aaaにある要素の数だけ繰り返す 例2 list(filter(lambda x: x > 1 and x < 7, tuki2)) 12345678910 例1 a = [1, -2, 3, -4, 5]list(filter(lambda x: x>0, aaa)) #xはこの場限りの変数aaaはフィルターしたい文字の入った変数#変数aaaにある要素の数だけ繰り返す 例2list(filter(lambda x: x > 1 and x < 7, tuki2)) Tweet [`yahoo` not found]
コメントを残す