import heapq
#y为结果列表,n为所求的n个值,x为来源列表
y=heapq.nsmallest(n,x)
y=heapq.nlargest(n,x)
posted on 2023-02-19 09:35  FrostyForest  阅读(34)  评论(0编辑  收藏  举报