热线电话:13121318867

登录
2019-01-24 阅读量: 737
python的内置函数all的用法是什么?

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

代码如下:

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

发表评论

暂无数据
推荐帖子