我在SO上遇到了这个问题Python: What is the best way to check if a list is empty?。
现在,如果我想根据一个函数的集合coll是否是非空(empty)来返回一个True (False),推荐的方法是什么?return not not coll?
发布于 2010-09-16 20:39:34
你可以使用
return bool(coll)https://stackoverflow.com/questions/3726692
复制相似问题