源码:abs
def abs(*args, **kwargs): # real signature unknown
""" Return the absolute value of the argument. """
pass
使用说明:返回传入参数的绝对值
用法:abs(数字)
eg:
print(abs(-5))
t = abs(-2)
print(t)
返回值:
5
2
源码:all
def all(*args, **kwargs): # real signature unknown
"""
Return True if bool(x) is True for all values x in the iterable.
If the iterable is empty, return True.
"""
pass
使用说明:1.当迭代中所有值为真,则返回True; 2.当迭代为空,返回True
print(all([])) # 列表
print(all([1, 2, 3, 4, 5])) # 列表
print(all(())) # 元组
print(all((1, 2, 3, 4, 5))) # 元组
print(all({})) # 字典
print(all({'a': 1})) # 字典
返回值:
True
True
True
True
True
True
什么时候返回False 呢?
bool(x) 的返回值为0时候就返回False