【Python】filter()的結果仍能夠被filter()

def test_twice_filter():
    list_a = [1, 2, 3, 4, 5]
    x = filter(lambda m: m > 2, list_a)
    y = filter(lambda n: n < 4, x)
    print(list(y))

if __name__ == '__main__':
    test_twice_filter()

結果:python

ssh://root@250.250.250.250:250/usr/bin/python3.6 -u /home/dba/HAL_9000/dbAlertAPP/filters/misc_item_filter.py
[3]

參考閱讀:ssh

相關文章
相關標籤/搜索