Python 列表 max() 方法

描述

Python 列表 max() 方法返回列表元素中的最大值。

语法

max() 方法语法:

max(L)

参数

  • L -- 要返回最大值的列表。

返回值

返回列表元素中的最大值。

实例

以下实例展示了 max() 方法的使用方法:

#!/usr/bin/python3

L1, L2 = ['Google', 'Runoob', 'Taobao'], [456, 700, 200]

print ("L1 最大元素值 : ", max(L1))
print ("L2 最大元素值 : ", max(L2))

以上实例输出结果如下:

L1 最大元素值 :  Taobao
L2 最大元素值 :  700
原文地址:https://www.cnblogs.com/wushuaishuai/p/7728955.html