Python: sorting a dictionary of lists

前端 未结 4 771
囚心锁ツ
囚心锁ツ 2020-12-02 08:42

Still learning python (finally!) and can\'t quite wrap my head around this one yet. What I want to do is sort a dictionary of lists by value using the third item in the lis

4条回答
  •  独厮守ぢ
    2020-12-02 09:16

    Late to the party and I don't know if this is what you had in mind, but it may be useful to someone. If output is supposed to be a list:

    list_third =[]
    
    for x in my_dic.keys():
        list_third.append(my_dic[x][2])
    

提交回复
热议问题