from heapq import *
#mylist = [8,20,2,13,4,45,5,6] #如果是数字将按照由小到大排序
mylist = ['yan','peng','d','g','k','e'] #如果是字符,将按照首字母由小到大排序
heapify(mylist) #将列表转化为堆
from heapq import *
#mylist = [8,20,2,13,4,45,5,6] #如果是数字将按照由小到大排序
mylist = ['yan','peng','d','g','k','e'] #如果是字符,将按照首字母由小到大排序
heapify(mylist) #将列表转化为堆