Python3 列表max()方法
2019-09-09
3
0
max() 方法返回列表元素中的最大值。
语法
max()方法语法:
max(list)
参数
- list — 要返回最大值的列表。
返回值
返回列表元素中的最大值。
实例
以下实例展示了 max()函数的使用方法:
#!/usr/bin/python3
list1, list2 = ['Google', 'bytekits', 'Taobao'], [456, 700, 200]
print ("list1 最大元素值 : ", max(list1))
print ("list2 最大元素值 : ", max(list2))
以上实例输出结果如下:
list1 最大元素值 : bytekits
list2 最大元素值 : 700