python 找出list中最大或者最小几個數的索引

nums = [1,8,2,23,7,-4,18,23,24,37,2] result = map(nums.index, heapq.nlargest(3, nums)) temp=[] Inf = 0 for i in range(3): temp.append(nums.index(max(nums))) nums[nums.index(max(nums))]=Inf res
相關文章
相關標籤/搜索