【问题标题】:How to find position of big value in python list array [duplicate]如何在python列表数组中找到大值的位置[重复]
【发布时间】:2021-08-10 08:33:15
【问题描述】:

list = [3,5,1,8,9] 我想在列表中找到最大值的位置

【问题讨论】:

  • lst.index(max(lst)) 试试

标签: python


【解决方案1】:

这很简单,但它会给你第一次出现的索引:

>>> l = [3,5,1,8,9]
>>> l.index(max(l))
4

我强烈建议您不要将内置函数的名称用作变量的list

【讨论】:

    猜你喜欢
    • 2018-05-08
    • 1970-01-01
    • 2019-07-05
    • 2021-02-24
    • 1970-01-01
    • 2012-10-20
    • 2011-04-28
    • 2021-12-19
    相关资源
    最近更新 更多