标签:cat mic bsp img als nbsp foo col image
def bifurcate_by(lst, fn): print(lst) # [‘beep‘, ‘boop‘, ‘foo‘, ‘bar‘] print(fn(‘baby‘)) # True print(fn(‘abc‘)) # False print([ [x for x in lst if fn(x)], [x for x in lst if not fn(x)] ]) bifurcate_by( [‘beep‘, ‘boop‘, ‘foo‘, ‘bar‘], lambda x: x[0] == ‘b‘ ) # [[‘beep‘, ‘boop‘, ‘bar‘], [‘foo‘]]
标签:cat mic bsp img als nbsp foo col image
原文地址:https://www.cnblogs.com/hany-postq473111315/p/12821676.html