先生成字典
>>> x = [3,2,1] # 作为key
>>> y = [5,6,7] # 作为value
>>> z = dict(zip(x,y))
>>> z
{3: 5, 2: 6, 1: 7}
按照key排序
sorted(z.items(),key=lambda item:item[0])
[(1, 7), (2, 6), (3, 5)]
按照value排序
sorted(z.items(),key=lambda item:item[1])
[(3, 5), (2, 6), (1, 7)]