Prettiest way to filter a list?

后端 未结 0 1466
面向向阳花
面向向阳花 2021-02-18 22:19

I know the existence of both functions

list(filter(lambda x : 1 if x.at else 0, a_list))
[item for item in a_list if item.at]

Even the second one

相关标签:
回答
  • 消灭零回复
提交回复
热议问题