將python字典裏的數據按照主鍵或值的大小排序

c=sorted(dict1.items(),key=lambda x:x[0]) #這裏的0改成1時 是按照值排序的,後面能夠加上reverse=True 排倒序
相關文章
相關標籤/搜索