python找出列表中最小的元素_python实现获取序列中最小的几个元素
本文实例讲述了python实现获取序列中最小的几个元素。分享给大家供大家参考。具体方法如下:import heapqimport randomdef issorted(data):data = list(data)heapq.heapify(data)while data:yield heapq.heappop(data)alist = [x for x in range(10)]random.s...