Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 310 Bytes

65.md

File metadata and controls

19 lines (13 loc) · 310 Bytes
@author jackzhenguo
@desc 
@date 2019/4/6

65 压缩列表

def filter_false(lst):
    return list(filter(bool, lst))


r = filter_false([None, 0, False, '', [], 'ok', [1, 2]])
print(r)  # ['ok', [1, 2]]
[上一个例子](64.md) [下一个例子](66.md)