#-*- coding:utf-8 -*-
#python 中 all() 和any()的用法
a = [1,2,3,4,False]
print(all(a))
print(any(a))
#如果a中所有项为True, all(a) = True
#如果a中任意项为True, any(a) = True
b = [1,2,3,4,5,6]
sum(b)
print(b.count(3))
#b中 3 元素个数
print(b.index(3))
#b中 3 元素的下标
python中几个内建函数
最新推荐文章于 2024-08-03 15:52:31 发布