热线电话:13121318867

登录
2019-03-14 阅读量: 590
python中all函数的用法

python中all函数的用法

解释:如果可迭代的对象(数组,字符串,列表等,下同)中的元素都是 true (或者为空)的话返回 True 。

代码如下:

_all = True
for item in iterable:
if not item:
_all = False
break
if _all:
# do stuff
11.0590
3
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子