[Python] Sorting the list of dictionaries in descending order of a particular key [duplicate]

Discussão em 'Python' iniciado por Stack, Março 12, 2025.

  1. Stack

    Stack Membro Participativo

    I have a list of dictionaries in python, for example

    [{'a':3, 'b':4, 'c':5, 'd':'6'}, {'a':1, 'b':2, 'c':7, 'd':'9'}]


    I want to sort it based on the value of 'c' in descending order. I tried using sorted() method using key = lambda but no help.

    Any ideas??

    Continue reading...

Compartilhe esta Página