RISEBY
>>>print max.__doc__max(iterable[, key=func]) -> valuemax(a, b, c, ...[, key=func]) -> valueWith a single iterable argument, return its largest item.With two or more arguments, return the largest argument. 后面的func,是比较函数,条件成立后,max执行结束。 所以: >>> array1 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> max(array1, key=lambda x: x > 6) 7 如果: >>> max([i for i in range(0,9)], key=lambda x: x >= 6)6 执行结果就是6