https://www.cnblogs.com/Joyce-song94/p/7149440.html
heapq.
nsmallest
(n, iterable[, key])
Return a list with the n smallest elements from the dataset defined by iterable. key, if provided, specifies a function of one argument that is used to extract a comparison key from each element in the iterable: key=str.lower
Equivalent to: sorted(iterable, key=key)[:n]
堆排序
set1 = set()
set1.add(1)
set1.add(2)
set1.add(3)
d = {}
d[0]=-1
d[1]=4
d[2]=5
d[3]=6
a = [1, 5, 2, 1, 9, 1, 5, 10]
order = hp.nsmallest(len(d),d)
for i in order:
if i in set1:
print("smallest in set1 is ",i)
break
print("ok")
#result
#对字典排序
https://blog.youkuaiyun.com/qq_41800366/article/details/86253908
#python lamda表达式
https://www.cnblogs.com/jszfy/p/11148963.html
字典是否可迭代
https://www.cnblogs.com/wangbin2188/p/6532510.html
smallest in set1 is 1
ok