@author jackzhenguo @desc @date 2019/4/15 72 按条件分组 def bif_by(lst, f): return [ [x for x in lst if f(x)],[x for x in lst if not f(x)]] 测试举例: records = [25,89,31,34] bif_by(records, lambda x: x<80) # [[25, 31, 34], [89]] [上一个例子](71.md) [下一个例子](73.md)