2017-04-21から1日間の記事一覧
Pythonでよく調べなおすので、個人的なチートシート map, filter items = [1, 2, 3] map(lambda n:n+20, items) # => [21, 22, 23] [x+20 for x in items] # => [21, 22, 23] filter(lambda n:n%2==1, items) # => [1, 3] [x for x in items if x%2==1] # =>…
Pythonでよく調べなおすので、個人的なチートシート map, filter items = [1, 2, 3] map(lambda n:n+20, items) # => [21, 22, 23] [x+20 for x in items] # => [21, 22, 23] filter(lambda n:n%2==1, items) # => [1, 3] [x for x in items if x%2==1] # =>…