# filter(抽出, where)

# PHP

array_filter($arr1, 'strlen');

# Python

filter(func, items)
[x for x in items if func(x)]
items = [1, 2, 3, 4, 5]

filter(lambda x : x < 3, items)        # => [1, 2]
[x for x in [1, 2, 3, 4, 5] if x < 3]  # => [1, 2]

[ 📩 ご意見 ]